The scenario is that I tried to create a bunny in performancetest sample about 2 or 3 times per second using the following codes(actually I just wanted to put stress on GC and see how our GC thread reacts):
mMainScene = mGVRContext.getMainScene();
GVRCameraRig mainCameraRig = mMainScene.getMainCameraRig();
int i = (int)(counter / 15);
GVRSceneObject bunny = null;
try {
// we assume that the mesh and the textures are valid
bunny = new GVRSceneObject(mGVRContext,
mGVRContext.loadFutureMesh(new GVRAndroidResource(mGVRContext,
"bunny.obj")),
mGVRContext.loadFutureTexture(new GVRAndroidResource(
mGVRContext, textureNames[i
% textureNames.length])));
} catch (IOException e) {
e.printStackTrace();
mActivity.finish();
Log.e(TAG,
"Mesh or texture were not loaded. Stopping application!");
}
Random random = new Random();
bunny.getTransform().setPosition(0.0f, 0.0f,
random.nextFloat() * 3.0f + 2.0f);
bunny.getTransform().rotateByAxisWithPivot(
random.nextFloat() * 360.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f);
bunny.getTransform().rotateByAxisWithPivot(
random.nextFloat() * 360.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
0.0f);
bunny.getTransform().rotateByAxisWithPivot(
random.nextFloat() * 360.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.0f);
bunny.getTransform().translate(0.0f, 0.0f, -10.0f);
//mainCameraRig.getOwnerObject().addChildObject(bunny);
float x = random.nextFloat() - 0.5f;
float y = random.nextFloat() - 0.5f;
float z = random.nextFloat() - 0.5f;
float length = (float) Math.sqrt(x * x + y * y + z * z);
x /= length;
y /= length;
z /= length;
new GVRRotationByAxisWithPivotAnimation(bunny, //
5.0f + random.nextFloat() * 25.0f, //
360.0f, //
x, y, z, //
0.0f, 0.0f, -10.0f) //
.setRepeatMode(GVRRepeatMode.REPEATED).setRepeatCount(-1) //
.start(mAnimationEngine);
After some random time, it will go native crash with following native stack trace:
05-29 20:52:34.368 10764 10764 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-29 20:52:34.368 10764 10764 I DEBUG : Build fingerprint: 'samsung/trltexx/trlte:5.0.1/LRX22C/N910FXXE1BOAD:eng/test-keys'
05-29 20:52:34.368 10764 10764 I DEBUG : Revision: '12'
05-29 20:52:34.368 10764 10764 I DEBUG : ABI: 'arm'
05-29 20:52:34.368 10764 10764 I DEBUG : pid: 12245, tid: 12290, name: pool-1-thread-5 >>> org.gearvrf.performancetest <<<
05-29 20:52:34.368 10764 10764 I DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
05-29 20:52:34.418 10764 10764 I DEBUG : r0 00000000 r1 aec85288 r2 aec85318 r3 aecca300
05-29 20:52:34.418 10764 10764 I DEBUG : r4 aec852d0 r5 00000000 r6 aec851c0 r7 aec852b8
05-29 20:52:34.418 10764 10764 I DEBUG : r8 aec852a0 r9 aec33428 sl 00000000 fp aec85258
05-29 20:52:34.418 10764 10764 I DEBUG : ip b3b9bb80 sp 9669b7d8 lr b3a13540 pc b3a13540 cpsr 00000010
05-29 20:52:34.418 10764 10764 I DEBUG :
05-29 20:52:34.418 10764 10764 I DEBUG : backtrace:
05-29 20:52:34.428 10764 10764 I DEBUG : #00 pc 00132540 /data/app/org.gearvrf.performancetest-2/lib/arm/libgvrf.so (gvr::AssimpImporter::getMesh(int)+436)
05-29 20:52:34.428 10764 10764 I DEBUG : #1 pc 00132944 /data/app/org.gearvrf.performancetest-2/lib/arm/libgvrf.so (Java_org_gearvrf_NativeAssimpImporter_getMesh+12)
05-29 20:52:34.428 10764 10764 I DEBUG : #2 pc 000bc10f /data/dalvik-cache/arm/data@[email protected]@[email protected]
05-29 20:52:39.858 10764 10764 I DEBUG :
05-29 20:52:39.858 10764 10764 I DEBUG : Tombstone written to: /data/tombstones/tombstone_07
I used arm-eabi-addr2line to check which line goes wrong and finally it points to 29th line of the codes inside assimp_importer.cpp :
aiMesh* ai_mesh = assimp_importer_->GetScene()->mMeshes[index];
I may go to check what is going wrong in this case.