By h0b0
on Thu, 11/21/2013 - 22:15
Hi there, I am an experienced android developper, and started using vuforia very recently. I have successfully built the ImageTargets sample and it works well with the default supplied images. However when I try to move in my custom images I am observing a constant and predictable crash. The first time I see my custom image (http://fc04.deviantart.net/fs70/f/2010/253/a/a/red_bag_icon_by_childmonster-d2yeq7i.jpg) or other images, the teapot gets placed on top as expected. However if I move away from the image (slowly, or quickly move my camera away from the image) I get a segmentation fault. When I get kicked back into the info activity and reload, the crash no longer happens and everything works normally. This makes me believe there's something not being initialized the first time over but I can't really know. Here is my log trace:
I/DEBUG ( 122): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***I/DEBUG ( 122): Build fingerprint: 'google/yakju/maguro:4.3/JWR66Y/776638:user/release-keys'I/DEBUG ( 122): Revision: '9'I/DEBUG ( 122): pid: 3387, tid: 3387, name: es.ImageTargets >>> com.qualcomm.QCARSamples.ImageTargets <<<I/DEBUG ( 122): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaadI/DEBUG ( 122): r0 00000027 r1 400a1348 r2 00000008 r3 deadbaadI/DEBUG ( 122): r4 00000000 r5 be9f7a2c r6 000014b4 r7 5a93a270I/DEBUG ( 122): r8 00000002 r9 ffffffff sl 5e74f7c8 fp a1c5faa8I/DEBUG ( 122): ip 00000001 sp be9f7a28 lr 401a2f93 pc 401a04e8 cpsr 60070030I/DEBUG ( 122): d0 0000000000000001 d1 0000000000000000I/DEBUG ( 122): d2 40cec3a043070e3e d3 c2da4edc44a66611I/DEBUG ( 122): d4 3f800000c3ef687c d5 be7d8200439cc000I/DEBUG ( 122): d6 c411a429439cc000 d7 4057000000000000I/DEBUG ( 122): d8 3cd10bd73f4ccccd d9 3f86075f430d4200I/DEBUG ( 122): d10 0000000000000000 d11 0000000000000000I/DEBUG ( 122): d12 0000000000000000 d13 0000000000000000I/DEBUG ( 122): d14 0000000000000000 d15 0000000000000000I/DEBUG ( 122): d16 3f3c4b59e6b58400 d17 3f0ae6cf40000000I/DEBUG ( 122): d18 bfd4d4a5aef14171 d19 3fa55555554d4ac9I/DEBUG ( 122): d20 be927e4f809abd22 d21 bf56c16c16bcb92cI/DEBUG ( 122): d22 3e21ee9ebdb3974c d23 3ff0000000000000I/DEBUG ( 122): d24 3fefffffff4b1373 d25 3e169d91a0000000I/DEBUG ( 122): d26 3f023de10dfdf709 d27 3fb3b8c5b12e9282I/DEBUG ( 122): d28 3feff780b5f0f167 d29 3f12d8d453917f82I/DEBUG ( 122): d30 3f12ddd6d55d5708 d31 3afcaa3237119b04I/DEBUG ( 122): scr 80000016I/DEBUG ( 122):I/DEBUG ( 122): backtrace:I/DEBUG ( 122): #00 pc 0001e4e8 /system/lib/libc.soI/DEBUG ( 122): #01 pc 0001c510 /system/lib/libc.so (abort+4)I/DEBUG ( 122): #02 pc 00000921 /system/lib/libstdc++.so (operator new(unsigned int)+8)I/DEBUG ( 122): #03 pc 000935e8 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #04 pc 00098384 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #05 pc 000991a8 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #06 pc 00076fec /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #07 pc 0007863c /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #08 pc 00078844 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #09 pc 00087608 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #10 pc 00087e20 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #11 pc 0005e7ec /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #12 pc 0005ebac /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #13 pc 000596bc /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #14 pc 001842b8 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #15 pc 00185f74 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #16 pc 001966b0 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #17 pc 001edec8 /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI/DEBUG ( 122): #18 pc 0001dc4c /system/lib/libdvm.so (dvmPlatformInvoke+112)I/DEBUG ( 122): #19 pc 0004decf /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)I/DEBUG ( 122): #20 pc 00027060 /system/lib/libdvm.soI/DEBUG ( 122): #21 pc 0002b5ec /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)I/DEBUG ( 122): #22 pc 000601df /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+350)I/DEBUG ( 122): #23 pc 00067ddf /system/lib/libdvm.soI/DEBUG ( 122): #24 pc 00027060 /system/lib/libdvm.soI/DEBUG ( 122): #25 pc 0002b5ec /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)I/DEBUG ( 122): #26 pc 0005ff21 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)I/DEBUG ( 122): #27 pc 00049b67 /system/lib/libdvm.soI/DEBUG ( 122): #28 pc 0004b697 /system/lib/libandroid_runtime.soI/DEBUG ( 122): #29 pc 0004c327 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+378)I/DEBUG ( 122): #30 pc 0000105b /system/bin/app_processI/DEBUG ( 122): #31 pc 0000db4f /system/lib/libc.so (__libc_init+50)I/DEBUG ( 122):I/DEBUG ( 122): stack:I/DEBUG ( 122): be9f79e8 3f4dfaf1I/DEBUG ( 122): be9f79ec 4018f9ad /system/lib/libc.so (malloc+12)I/DEBUG ( 122): be9f79f0 401ca170 /system/lib/libc.soI/DEBUG ( 122): be9f79f4 400a1348I/DEBUG ( 122): be9f79f8 00000015I/DEBUG ( 122): be9f79fc 401a1f75 /system/lib/libc.so (__sflush+56)I/DEBUG ( 122): be9f7a00 401ca264 /system/lib/libc.soI/DEBUG ( 122): be9f7a04 401ca1c4 /system/lib/libc.soI/DEBUG ( 122): be9f7a08 00000000I/DEBUG ( 122): be9f7a0c 401a2f93 /system/lib/libc.so (_fwalk+34)I/DEBUG ( 122): be9f7a10 401a223d /system/lib/libc.so (_cleanup)I/DEBUG ( 122): be9f7a14 be9f7a2c [stack]I/DEBUG ( 122): be9f7a18 000014b4I/DEBUG ( 122): be9f7a1c 5a93a270I/DEBUG ( 122): be9f7a20 df0027adI/DEBUG ( 122): be9f7a24 00000000I/DEBUG ( 122): #00 be9f7a28 6138f968I/DEBUG ( 122): be9f7a2c fffffbdfI/DEBUG ( 122): be9f7a30 7e9bf5e3I/DEBUG ( 122): be9f7a34 000014b4I/DEBUG ( 122): be9f7a38 5a93a270I/DEBUG ( 122): be9f7a3c 00000002I/DEBUG ( 122): be9f7a40 ffffffffI/DEBUG ( 122): be9f7a44 5a93a270I/DEBUG ( 122): be9f7a48 7e9bf5e3I/DEBUG ( 122): be9f7a4c 4019e514 /system/lib/libc.so (__pthread_clone)I/DEBUG ( 122): #01 be9f7a50 6138f970I/DEBUG ( 122): be9f7a54 4007e925 /system/lib/libstdc++.so (operator new(unsigned int)+12)I/DEBUG ( 122): #02 be9f7a58 6138f970I/DEBUG ( 122): be9f7a5c 5f7e55ec /data/app-lib/com.qualcomm.QCARSamples.ImageTargets-2/libQCAR.soI am unable to use ndk-stack on the libraries, I don't really know why (I am using obj/local/armeabi/*.so) so I can't find any more info than this. The only change I have made in the entire project is as follows:1) add my text.xml and test.dat files into assets folder.2) change loadTrackerData() in ImageAssets.cpp to the following (changed from loading chips and stones to test.xml, and remove tarmack):
JNIEXPORT int JNICALLJava_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_loadTrackerData(JNIEnv *, jobject){ LOG("Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_loadTrackerData"); // Get the image tracker: QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>( trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER)); if (imageTracker == NULL) { LOG("Failed to load tracking data set because the ImageTracker has not" " been initialized."); return 0; } // Create the data sets: dataSetStonesAndChips = imageTracker->createDataSet(); if (dataSetStonesAndChips == 0) { LOG("Failed to create a new tracking data."); return 0; } // Load the data sets: if (!dataSetStonesAndChips->load("test.xml", QCAR::DataSet::STORAGE_APPRESOURCE)) { LOG("Failed to load data set."); return 0; } // Activate the data set: if (!imageTracker->activateDataSet(dataSetStonesAndChips)) { LOG("Failed to activate data set."); return 0; } LOG("Successfully loaded and activated data set."); return 1;}I can probably host the project if anybody wants to take a look at it, but it's the same as the sample, really. Assets attached so others can try.
Any help is greatly appreciated.
Crash in sample with custom images
Have you checked the suggested implementation ere:
https://developer.vuforia.com/forum/faq/android-how-do-i-replace-dataset-image-targets-sample
Crash in sample with custom images
Yes I have set it up that way.
In fact in my real project I have the datasets loading dynamically, I just set this new one up quickly to demonstrate the bug.
Crash in sample with custom images
Ok, so, the segmentation fault error typically results from a threading issue (such as a race condition);
if you are loading datasets dynamically, this may explain the threading issue;
Crash in sample with custom images
What about this simpler project though? I made very little changes to it and there is a reproducible crash. I only load/destroy the data in the same spot as the sample project, and I've cleared the update function's body since I have no switching.
Crash in sample with custom images
Even when following the instructions here https://developer.vuforia.com/forum/faq/android-how-do-i-replace-dataset-image-targets-sample I get the crash. Here's the diff:
Crash in sample with custom images
One thing to keep in mind is that you can only Destroy datasets if these contain User Defined Targets;
if you have datasets loaded from file, you may not destroy them; more precisely, the targets will not be cleared from memory.
Crash in sample with custom images
Right now I am just loading one dataset, who's db has 1 image file in it. I have it set up to load a dynamic number of images, however I only ever load the assets from the start, so this isn't a problem of loading during processing.
Crash in sample with custom images
Ok. weird.
What version of Vuforia are you using ? and when did you create your dataset ? (recently ?)
Crash in sample with custom images
My SDK version is 2.6.10 (ImageTarget shows as 2.6.7 in samples, I assume it hasn't changed).
I have built different datasets throughout development, so it ranges from 2 weeks to yesterday.
Crash in sample with custom images
I just installed eclipse (fresh), with a new sdk folder (fresh), and a new sample app project (fresh).
Crash in sample with custom images
Can you try creating a new dataset with 1 or 2 targets and try again ?
If all you have changed is this code (and literally only this code):
Crash in sample with custom images
I have tried loading datasets with 1-2-3 targets, just finished one up with more than 5 targets, all randomly from google.
Here is a list of images I tried:
works:
Crash in sample with custom images
Ok. I see that among the failing images, yu have a couple of them with a zero stars rating.
Zero-star targets should not be used (i.e. you should not include them in your dataset);
Crash in sample with custom images
Crash in sample with custom images
I tried creating 4 datasets using varoious combinations of the following selection from your images:
http://scholarshipland.org/wp-content/uploads/2013/07/Coca-Cola-logo.jpg (5 stars)
Crash in sample with custom images
Ok, let me create a few datasets with your images and try to reproduce it.
Crash in sample with custom images
I very recently received my nexus 5 in the mail, and have tried the sample with it. I have also tried it with other devices around the office. So far so good, no crashes.
Crash in sample with custom images
Ok, keep us posted in case problem persist on that specific device even after clearing it.
Crash in sample with custom images
Factory reset my phone today, it's still happening.
Galaxy Nexus 4.3 GSM - JWR66Y
Crash in sample with custom images
OK.
Can you then indicate a combination of image targets that we can use as a reference for testing this issue ?
(i.e. one for which you are sure you can sistematically reproduce the issue)
So, then I will be able to recreate the same dataset and test on that device.
Crash in sample with custom images
This 5 star image crashes on a consistent basis on the gnexus: http://www.buddsonline.com/usercontent/images/Red_Bag%20%28Medium%29.jpg