objectbox-java: Crash when removing relation and related entity
When I upgrade app it would crash when init objectbox, logcat is below:
--------- beginning of crash
07-02 10:41:32.395 7478-7519/com.gnet.uc A/libc: Fatal signal 11 (SIGSEGV), code -6, fault addr 0x1d36 in tid 7519 (Thread-4)
07-02 10:41:32.397 404-404/? I/MIUINDBG_HOOK: hook hook_sigtimedwait
07-02 10:41:32.477 7524-7524/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-02 10:41:32.478 7524-7524/? A/DEBUG: Build fingerprint: 'Xiaomi/helium/helium:7.0/NRD90M/V9.5.2.0.NBDCNFA:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 7478, tid: 7519, name: Thread-4 >>> com.gnet.uc <<<
signal 11 (SIGSEGV), code -6 (SI_TKILL), fault addr 0x1d36
07-02 10:41:32.479 7524-7524/? A/DEBUG: r0 00000000 r1 00000012 r2 e31ec381 r3 00000000
r4 e12cdce0 r5 e12cdd54 r6 00009be7 r7 ccbcb1f0
r8 00000000 r9 ccbcb3a4 sl 00000000 fp 00000000
ip cca71e70 sp ccbcb168 lr cc997775 pc cc9c1c86 cpsr 600b0030
07-02 10:41:32.484 7524-7524/? A/DEBUG: backtrace:
#00 pc 000b4c86 /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZNK9objectbox6Schema20getEntityByIdOrThrowEj+21)
#01 pc 0008a771 /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox6Cursor22getForeignEntityCursorEj+80)
#02 pc 0008ac1f /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox6Cursor16findBacklinkKeysEPNS_8PropertyEyRNSt6__ndk16vectorIyNS3_9allocatorIyEEEE+58)
#03 pc 0008a69b /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox6Cursor14clearBacklinksEy+86)
07-02 10:41:32.485 7524-7524/? A/DEBUG: #04 pc 0008a335 /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox6Cursor6removeEv+336)
#05 pc 0008c351 /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox6Cursor9removeAllEv+86)
#06 pc 000bb7ed /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox8SchemaDb23removeEntityWithAllDataEPKNS_6EntityE+36)
#07 pc 000bfa09 /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox10SchemaSync10syncSchemaERNS_13SchemaCatalogERNS_6SchemaES4_+520)
#08 pc 000bc271 /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox10SchemaSync4syncENSt6__ndk110shared_ptrINS_6SchemaEEEPKNS_5model5ModelE+248)
#09 pc 000bbe7f /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (_ZN9objectbox10SchemaSync4syncEPKNS_5model5ModelE+154)
#10 pc 000cead3 /data/app/com.gnet.uc-1/lib/arm/libobjectbox.so (Java_io_objectbox_BoxStore_nativeCreate+170)
#11 pc 02ddf20d /data/app/com.gnet.uc-1/oat/arm/base.odex (offset 0x2d7c000)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (8 by maintainers)
@greenrobot I have a reliable reproduction for this case in the form of this repo: https://github.com/raja-baz/objectbox-490-reproduction
Steps to reproduce:
8a5070a28bb23f1108d60e56b181a67bd95138381243aac8fa6fdf46892395cd89646592a695d916This seems to be an issue during migration when an entity which is used as a target for a relation is removed. Some additional tests show that:
For now, we’ve decided to keep the legacy entities and not delete them to work around this issue while just not using them. Obviously this isn’t ideal, but a segfault on app launch is even less ideal 😛
Cheers
PS: This is on latest object box(2.1) and the crash in question is:
@greenrobot I was having this same issue and I don’t see it anymore with
2.4.0-RC@greenrobot , any updates on the bug fix?
I encountered similar crash as well. After the app is published, users will encounter crash, if they update the app while the app is running (background). However, if they clear the app (not running in background) before updating it, everything works fine.
@raja-baz Thanks for your repro project, could verify the crash. Using this issue is fine as the original reporter has not responded.
Passed this on to the development team. -ut