Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

Null pointer reference in onAddedToScene #1962

Closed SteveGreatApe closed 6 years ago

SteveGreatApe commented 6 years ago

I synced to the latest code and started hitting this crash on startup, 90% of the time I'm getting the crash, the other 10% it starts up enough to draw the view, but then the view is frozen.

Reverting back to just before this commit got things working again for me, https://github.com/Samsung/GearVRf/commit/6206cb0a2614b0bd31f6cdbb1df1e57c7623bafe

2018-08-13 17:51:22.242 3346-3346/? I//system/bin/tombstoned: received crash request for pid 7831
2018-08-13 17:51:22.244 7947-7947/? I/crash_dump32: performing dump of process 7831 (target tid = 7875)
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG: Build fingerprint: 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXU2ERG2:user/release-keys'
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG: Revision: '8'
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG: ABI: 'arm'
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG: pid: 7831, tid: 7875, name: GLThread 16361  >>> com.greatape.avrgallery <<<
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG: Cause: null pointer dereference
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG:     r0 00000022  r1 c24c61a8  r2 345ad82c  r3 00000000
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG:     r4 00000006  r5 d5bb5480  r6 00000000  r7 c24c61c8
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG:     r8 00000056  r9 d2ea5000  sl c24c6230  fp d2ea5000
2018-08-13 17:51:22.245 7947-7947/? A/DEBUG:     ip e66b1d78  sp c24c6098  lr c3ead7cb  pc c3ead7d6  cpsr 600f0030
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG: backtrace:
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #00 pc 002e57d6  /data/app/com.greatape.avrgallery-DISeU8msuwiKB12LMRJInQ==/lib/arm/libgvrf.so (_ZN3gvr11SceneObject14onAddedToSceneEPNS_5SceneE+277)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #01 pc 002e3381  /data/app/com.greatape.avrgallery-DISeU8msuwiKB12LMRJInQ==/lib/arm/libgvrf.so (_ZN3gvr5Scene14set_main_sceneEPS0_+28)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #02 pc 002e46b7  /data/app/com.greatape.avrgallery-DISeU8msuwiKB12LMRJInQ==/lib/arm/libgvrf.so (Java_org_gearvrf_NativeScene_setMainScene+36)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #03 pc 003e33f9  /system/lib/libart.so (art_quick_generic_jni_trampoline+40)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #04 pc 003df6b1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #05 pc 003e3d29  /system/lib/libart.so (art_quick_invoke_static_stub+224)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #06 pc 000ac647  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+182)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #07 pc 001f271f  /system/lib/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+238)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #08 pc 001edc95  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+576)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #09 pc 0020e71f  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE0ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+262)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #10 pc 00208b91  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+25864)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #11 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #12 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #13 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #14 pc 0020d7bd  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE1ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+296)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #15 pc 0020bb03  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+38010)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #16 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #17 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #18 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.284 7947-7947/? A/DEBUG:     #19 pc 0020c58d  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE2ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+412)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #20 pc 00209b4d  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+29892)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #21 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #22 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #23 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #24 pc 0020df1f  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE4ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+1198)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #25 pc 00208991  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+25352)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #26 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #27 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #28 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #29 pc 0020c58d  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE2ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+412)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #30 pc 00209b4d  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+29892)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #31 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #32 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #33 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #34 pc 0020df1f  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE4ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+1198)
2018-08-13 17:51:22.285 7947-7947/? A/DEBUG:     #35 pc 00208991  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+25352)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #36 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #37 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #38 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #39 pc 0020d7bd  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE1ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+296)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #40 pc 0020bb03  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+38010)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #41 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #42 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #43 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #44 pc 0020e71f  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE0ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+262)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #45 pc 00208b91  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+25864)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #46 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #47 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #48 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #49 pc 0020c58d  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE2ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+412)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #50 pc 00209b4d  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+29892)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #51 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #52 pc 001da5c7  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+142)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #53 pc 001edc7f  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+554)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #54 pc 0020cd49  /system/lib/libart.so (_ZN3art11interpreterL8DoInvokeILNS_10InvokeTypeE3ELb0ELb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+1112)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #55 pc 0020b733  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+37034)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #56 pc 001d52c5  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+420)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #57 pc 001da515  /system/lib/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+92)
2018-08-13 17:51:22.286 7947-7947/? A/DEBUG:     #58 pc 003bfd3d  /system/lib/libart.so (artQuickToInterpreterBridge+944)
2018-08-13 17:51:22.287 7947-7947/? A/DEBUG:     #59 pc 003e3471  /system/lib/libart.so (art_quick_to_interpreter_bridge+32)
2018-08-13 17:51:22.287 7947-7947/? A/DEBUG:     #60 pc 003df6b1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
2018-08-13 17:51:22.287 7947-7947/? A/DEBUG:     #61 pc 003e3c23  /system/lib/libart.so (art_quick_invoke_stub+226)
2018-08-13 17:51:22.287 7947-7947/? A/DEBUG:     #62 pc 000ac61d  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+140)
2018-08-13 17:51:22.287 7947-7947/? A/DEBUG:     #63 pc 00334341  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+52)
liaxim commented 6 years ago

Thanks for letting us know. Since this is a change I made, I will look into fixing your problem.

liaxim commented 6 years ago

@SteveGreatApe Are you creating and setting new main scenes?

Also do you derive from GVRScene? Do you use removeAllSceneObjects? Do you use any of the loadXyz methods of the AssetLoader that take a scene parameter?

It looks very much like the root scene object is nullptr but nevertheless, could you please also run with this patch that outputs extra traces? Thanks. diff.txt

SteveGreatApe commented 6 years ago

Do you use removeAllSceneObjects?

That's the one, removed the call now and I'm up and running again with the latest build.

SteveGreatApe commented 6 years ago

And here's the result of the logging you requested, no null pointer showing

2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e3d40
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd5bb6b00
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp child: 0xd81e3e80
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e3e80
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd5bb6c40
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd5bb6ba0
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp child: 0xd81e3fc0
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e3fc0
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd5bb6ce0
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp child: 0xd81e4100
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e4100
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd5bb6d80
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xc4cf6e80
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp child: 0xd81e4240
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e4240
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd5bb6e20
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xc4cf6f00
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp child: 0xd81e4380
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e4380
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd5bb6ec0
2018-08-15 09:22:33.392 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xc4cf6f80
2018-08-15 09:22:34.864 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e4600
2018-08-15 09:22:34.864 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xc4ddfbe0
2018-08-15 09:22:34.864 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0xd8196880
2018-08-15 09:22:42.792 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp this: 0xd81e2a80
2018-08-15 09:22:42.792 16533-17138/com.greatape.avrgallery I/gvrf: scene_object.cpp component: 0x345ad82c
2018-08-15 09:22:42.794 16533-17138/com.greatape.avrgallery A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 17138 (GLThread 18140)
SteveGreatApe commented 6 years ago

I also tried setting a breakpoint on GVRViewManager.setMainSceneImpl to see where it was getting called from. It was on the second call to this function it crashed, you can see from the timestamps above there was an earlier batch of log events before the final couple before the crash.

The stack dump for this second call is:

setMainSceneImpl:145, GVRViewManager (org.gearvrf)
setMainScene:133, GVRViewManager (org.gearvrf)
finished:425, GVRViewManager$2$1$1$1 (org.gearvrf)
onDrawFrame:376, GVRAnimation (org.gearvrf.animation)
onDrawFrame:149, GVRAnimationEngine$DrawFrame (org.gearvrf.animation)
doMemoryManagementAndPerFrameCallbacks:280, GVRViewManager (org.gearvrf)
access$700:47, GVRViewManager (org.gearvrf)
beforeDrawEyes:400, GVRViewManager$2 (org.gearvrf)
beforeDrawEyes:512, GVRViewManager (org.gearvrf)
beforeDrawEyes:163, OvrViewManager (org.gearvrf)
drawEyes:-1, OvrViewManager (org.gearvrf)
onDrawFrame:254, OvrViewManager (org.gearvrf)
onDrawFrame:383, OvrVrapiActivityHandler$6 (org.gearvrf)
guardedRun:1571, GLSurfaceView$GLThread (android.opengl)
run:1270, GLSurfaceView$GLThread (android.opengl)
liaxim commented 6 years ago

Thanks. I can clearly see a bug in removeAllSceneObjects.

liaxim commented 6 years ago

@SteveGreatApe Tentative fix https://github.com/Samsung/GearVRf/pull/1966. Still don't know how exactly it happens. Also added few more traces that may be helpful if the fix doesn't work.

SteveGreatApe commented 6 years ago

This has caused another problem, I'm getting a null pointer for the GVRCameraRig transform.

A/zygote: java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.NullPointerException: Attempt to invoke virtual method 'org.joml.Matrix4f org.gearvrf.GVRTransform.getModelMatrix4f()' on a null object reference
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.io.GVRGearCursorController.handleControllerEvent(org.gearvrf.io.GVRGearCursorController$ControllerEvent) (GVRGearCursorController.java:530)
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.io.GVRGearCursorController.pollController() (GVRGearCursorController.java:429)
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.io.GVRInputManager.updateGearControllers() (GVRInputManager.java:415)
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.GVRViewManager.beforeDrawEyes() (GVRViewManager.java:516)
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.OvrViewManager.beforeDrawEyes() (OvrViewManager.java:163)
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.OvrViewManager.drawEyes(long) (OvrViewManager.java:-2)
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.OvrViewManager.onDrawFrame() (OvrViewManager.java:254)
A/zygote: java_vm_ext.cc:504]   at void org.gearvrf.OvrVrapiActivityHandler$6.onDrawFrame(javax.microedition.khronos.opengles.GL10) (OvrVrapiActivityHandler.java:383)
A/zygote: java_vm_ext.cc:504]   at void android.opengl.GLSurfaceView$GLThread.guardedRun() (GLSurfaceView.java:1571)
A/zygote: java_vm_ext.cc:504]   at void android.opengl.GLSurfaceView$GLThread.run() (GLSurfaceView.java:1270)
liaxim commented 6 years ago

Made an update. If it doesn't help, would you consider creating a test app that at least mimics the flow you have?

SteveGreatApe commented 6 years ago

The update didn't help, it's not a rare timing issue as it happens all the time, to reproduce it try this:

--- a/gvr-particles/app/src/main/java/org/gearvrf/particles/SampleMain.java
+++ b/gvr-particles/app/src/main/java/org/gearvrf/particles/SampleMain.java
@@ -41,6 +41,7 @@ public class SampleMain extends GVRMain {

         GVRScene scene = gvrContext.getMainScene();

+        scene.removeAllSceneObjects();
         scene.getMainCameraRig().getTransform().setPosition(0,0,0);
liaxim commented 6 years ago

What phone do you use? Thanks.

liaxim commented 6 years ago

Ok, NPE fixed. PR updated.

SteveGreatApe commented 6 years ago

Afraid still not fixed yet, first time I ran it it fired up fine with no problem, but then when I called removeAllSceneObjects() again at a later time it crashed with the following error. I also managed to hit that same error but putting a break point on the initial call to removeAllSceneObjects() and stepping through the code instead of letting it just run.

I'd guess that means there's some sort of race condition where if GVRGearCursorController is initialised before calling removeAllSceneObjects() it triggers the problem.


java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.NullPointerException: Attempt to invoke virtual method 'org.gearvrf.GVRTransform org.gearvrf.GVRTransform.setModelMatrix(org.joml.Matrix4f)' on a null object reference
java_vm_ext.cc:504]   at void org.gearvrf.io.GVRGearCursorController.handleControllerEvent(org.gearvrf.io.GVRGearCursorController$ControllerEvent) (GVRGearCursorController.java:544)
java_vm_ext.cc:504]   at void org.gearvrf.io.GVRGearCursorController.pollController() (GVRGearCursorController.java:429)
java_vm_ext.cc:504]   at void org.gearvrf.io.GVRInputManager.updateGearControllers() (GVRInputManager.java:415)
java_vm_ext.cc:504]   at void org.gearvrf.GVRViewManager.beforeDrawEyes() (GVRViewManager.java:516)
java_vm_ext.cc:504]   at void org.gearvrf.OvrViewManager.beforeDrawEyes() (OvrViewManager.java:163)
java_vm_ext.cc:504]   at void org.gearvrf.OvrViewManager.drawEyes(long) (OvrViewManager.java:-2)
java_vm_ext.cc:504]   at void org.gearvrf.OvrViewManager.onDrawFrame() (OvrViewManager.java:254)
java_vm_ext.cc:504]   at void org.gearvrf.OvrVrapiActivityHandler$6.onDrawFrame(javax.microedition.khronos.opengles.GL10) (OvrVrapiActivityHandler.java:383)
java_vm_ext.cc:504]   at void android.opengl.GLSurfaceView$GLThread.guardedRun() (GLSurfaceView.java:1571)
java_vm_ext.cc:504]   at void android.opengl.GLSurfaceView$GLThread.run() (GLSurfaceView.java:1270)
java_vm_ext.cc:504] 
java_vm_ext.cc:504]     in call to CallVoidMethodV
java_vm_ext.cc:504]     from void org.gearvrf.OvrViewManager.drawEyes(long)
liaxim commented 6 years ago

@SteveGreatApe Reproduced by running a loop of many iterations that concurrently does that:

        GVRScene scene = gvrContext.getMainScene();
        scene.removeAllSceneObjects();
        scene.getMainCameraRig().getTransform().setPosition(0,0,0);

In the latest update fixed a race condition in GVRGearCursorController; also prevented the controller-related updates from happening too early.

SteveGreatApe commented 6 years ago

Afraid still got problems, it's starting up reliably now where I'm calling removeAllSceneObjects() on initialisation before I've actually added anything.

But when I later use it to remove everything before rebuilding the scene again I'm still getting an exception here:

JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.NullPointerException: Attempt to invoke virtual method 'org.gearvrf.GVRTransform org.gearvrf.GVRTransform.setModelMatrix(org.joml.Matrix4f)' on a null object reference
  at void org.gearvrf.io.GVRGearCursorController.handleControllerEvent(org.gearvrf.io.GVRGearCursorController$ControllerEvent) (GVRGearCursorController.java:544)
  at void org.gearvrf.io.GVRGearCursorController.pollController() (GVRGearCursorController.java:428)
  at void org.gearvrf.io.GVRInputManager.updateGearControllers() (GVRInputManager.java:415)
  at void org.gearvrf.GVRViewManager$3.beforeDrawEyes() (GVRViewManager.java:471)
  at void org.gearvrf.GVRViewManager.beforeDrawEyes() (GVRViewManager.java:517)
  at void org.gearvrf.OvrViewManager.beforeDrawEyes() (OvrViewManager.java:163)
  at void org.gearvrf.OvrViewManager.drawEyes(long) (OvrViewManager.java:-2)
  at void org.gearvrf.OvrViewManager.onDrawFrame() (OvrViewManager.java:254)
  at void org.gearvrf.OvrVrapiActivityHandler$6.onDrawFrame(javax.microedition.khronos.opengles.GL10) (OvrVrapiActivityHandler.java:383)
  at void android.opengl.GLSurfaceView$GLThread.guardedRun() (GLSurfaceView.java:1571)
  at void android.opengl.GLSurfaceView$GLThread.run() (GLSurfaceView.java:1270)
liaxim commented 6 years ago

Ok, sorry about that. At least we are getting somewhere bit by bit. Thanks for your help.

liaxim commented 6 years ago

Have an update. There was a detachAllComponents call in removeAllSceneObjects that was a concern even at the time it was added. I do not see a good reason for it to be there. Removed. I am pretty sure the last NPE you showed was caused by it.

SteveGreatApe commented 6 years ago

That's looking better, all working fine so far.

liaxim commented 6 years ago

Fix has been merged. Planning to close the issue in a day or two if you don't mind.