iskdaemon
iskdaemon copied to clipboard
segmentation fault when queryImgID is called with fast=false
I'm managing 300k of image files and it crashes when I call
queryImgID(dbId, imgId, numres=28, sketch=0, fast=false)
(gdb) bt
#0 0x00007ffff5febef3 in queryImgDataFiltered (dbId=0, sig1=
at imgSeekLib/imgdb.cpp:715
#1 0x00007ffff5fed1ae in queryImgData (dbId=
at imgSeekLib/imgdb.cpp:768
#2 0x00007ffff5fed4bc in queryImgID (dbId=
---Type
what solved this?
I have the same issue on an index with 100K images. Is this issue resolved or is there any workaround. It happens only when sending "fast = false"
I am also encountering this segmentation fault issue when running with Fast on Mac OS X 10.8.3 . would you have some advices @ricardocabral ? Overall, would you recommend using imgseek ? you seem to have had quite a few issues with it ...
This doesn't seem solved yet. Investigation pending.
Thanks, you're right! I've applied the fixes to github.
Ricardo http://about.me/rncabral
On Wed, Oct 23, 2013 at 1:57 PM, nicsor [email protected] wrote:
Hi Ricardo, I managed to reproduce the issue and identify the reason. It seems that the issue is in addImageFromImage where you have a case in which you return "ERROR: dbId already in use". The problem is that you delete the element and return, which would leave undefined data in memory and when a query for the id with the issue is made, a segmentation fault occurs. Also, the code in that area had a memory leak of size SigStruct whenever we were on this case.
Please find attached the proposed solution. Also please reply if you agree with this modification.
Best Regards, Nicolae Natea
The changes are under tags /* +23/10/2013 nnatea isk daemon issue - Sharalike / / -23/10/2013 nnatea isk daemon issue - Sharalike */
int addImageFromImage(const int dbId, const long int id, Image * image ) {
..................
transformChar(rchan, gchan, bchan, cdata1, cdata2, cdata3);
DestroyExceptionInfo(&exception);
/* +23/10/2013 nnatea isk daemon issue - Sharalike / //should be created after the check for duplicates #if 0 / -23/10/2013 nnatea isk daemon issue - Sharalike / SigStruct *nsig = new SigStruct(); nsig->id = id; nsig->width = width; nsig->height = height; / +23/10/2013 nnatea isk daemon issue - Sharalike / #endif / -23/10/2013 nnatea isk daemon issue - Sharalike */
if (dbSpace[dbId]->sigs.count(id)) { /* +23/10/2013 nnatea isk daemon issue - Sharalike / // item exists ... but why delete it and return? // either delete it and continue OR not delete it and return #if 0 / -23/10/2013 nnatea isk daemon issue - Sharalike / delete dbSpace[dbId]->sigs[id]; dbSpace[dbId]->sigs.erase(id); / +23/10/2013 nnatea isk daemon issue - Sharalike / #endif / -23/10/2013 nnatea isk daemon issue - Sharalike */
cerr << "ERROR: dbId already in use" << endl; pthread_mutex_unlock( &mtx ); return 0;
}
/* +23/10/2013 nnatea isk daemon issue - Sharalike / //should be created after the check for duplicates SigStruct *nsig = new SigStruct(); nsig->id = id; nsig->width = width; nsig->height = height; / -23/10/2013 nnatea isk daemon issue - Sharalike */
// insert into sigmap dbSpace[dbId]->sigs[id] = nsig;
.............
}
— Reply to this email directly or view it on GitHubhttps://github.com/ricardocabral/iskdaemon/issues/52#issuecomment-26917507 .
This is probably related: If I add an image from a file with id set to 0 into an empty (initialised) db:
addImg(dbId, 0, filename)
A subsequent query on id 0 returns an error along the lines of "not in database". A query on id 1, however, returns an empty list (as expected for id 0).
I discovered this after adding 419 images starting at id 0 (up to id 418). The log showed adding with those id's, but I could not query any of them. I'm guessing that if I queried 419, I'd have got the last one?