Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash: Java_io_objectbox_query_Query_nativeFind #493

Closed
LeeKingHung opened this issue Jul 6, 2018 · 35 comments
Closed

Crash: Java_io_objectbox_query_Query_nativeFind #493

LeeKingHung opened this issue Jul 6, 2018 · 35 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@LeeKingHung
Copy link

LeeKingHung commented Jul 6, 2018

Issue Basics

  • ObjectBox version (are using the latest version?): 1.5.0
  • Reproducibility: Not always

I received the following crash when I called box.find method. This only happened sometimes. But once it happened, it would always happen later. Any clue ?

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/starltexx/starlte:8.0.0/R16NW/G960FXXU1BRE6:user/release-keys'
Revision: '26'
ABI: 'arm'
pid: 763, tid: 916, name: MyHandlerThread  >>> com.something <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x83804403
    r0 83804403  r1 00000036  r2 b7c957ac  r3 c1be0c93
    r4 b7c957ac  r5 bada9e78  r6 b7b57534  r7 bbdfd468
    r8 bc0a5488  r9 bc0a5480  sl 000003e8  fp bc0a5480
    ip e5826d5c  sp bbdfd458  lr c1bd7437  pc c1be0cb0  cpsr a0070030
backtrace:
    #00 pc 00051cb0  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
    #01 pc 00048435  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
    #02 pc 0004acd9  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
    #03 pc 0004aea7  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
    #04 pc 00047feb  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so
    #05 pc 0007d33d  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/lib/arm/libobjectbox.so (Java_io_objectbox_query_Query_nativeFind+72)
    #06 pc 000fa21d  /data/app/com.something-v37ezjtrI-iGSmyORUO3eQ==/oat/arm/base.odex (offset 0x38000)
@greenrobot
Copy link
Member

Could you repeat what you did using ObjectBox 2.0.0-beta and share the same output?

@LeeKingHung
Copy link
Author

LeeKingHung commented Jul 11, 2018

ObjectBox version: 1.5.0: Recently I did not notice any similar issue.

I will try v2 and observe. Thanks =)

@LeeKingHung
Copy link
Author

The same error still occurred after using 2.0.0. Should I delete the existing database (built in 1.5.0) and try again ?

@greenrobot
Copy link
Member

Thanks, could you post the same log? (starting with *** *** *** ....)

@LeeKingHung
Copy link
Author

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 Build fingerprint: 'samsung/hltedx/hlte:5.0/LRX21V/N9005DXSGBQA1:user/release-keys'
 Revision: '8'
 ABI: 'arm'
 pid: 10368, tid: 10486, name: pool-7-thread-1  >>> com.something <<<
 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xf6c424e3
	 r0 b4ebfd01  r1 90f3e5ac  r2 90f3e5a8  r3 00000020
	 r4 b4ebff11  r5 90f3e5b4  r6 b4efac64  r7 f6c424e3
	 r8 90f3e5a4  r9 00000009  sl b4ebfcf8  fp 00000001
	 ip b4efad5c  sp 90f3e510  lr f6c424e3  pc b4cb574e  cpsr a0070030
	 d0  0034002000450055  d1  0053004500570020
	 d2  c0c0c0c0c0c0c0c0  d3  0000000001020202
	 d4  0000004040404040  d5  0004000400040004
	 d6  ff00000000000000  d7  0000000000030004
	 d8  0000000000000000  d9  0000000000000000
	 d10 0000000000000000  d11 0000000000000000
	 d12 0000000000000000  d13 0000000000000000
	 d14 0000000000000000  d15 0000000000000000
	 d16 4e45564120485455  d17 5345572034204555
	 d18 0020004800540055  d19 004e004500560041
	 d20 0101010101010101  d21 0101010101010101
	 d22 8080808080808080  d23 8080808080808080
	 d24 0040404040404040  d25 4040404000000000
	 d26 0707070707070707  d27 0707070707070707
	 d28 0101010101010101  d29 0101010101010101
	 d30 0000000000000000  d31 0000000000000000
	 scr 20000011
 
 backtrace:
	 #00 pc 000b374e  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckEbPKcz.constprop.128+833)
	 #01 pc 000bc1e9  /system/lib/libart.so (art::CheckJNI::NewStringUTF(_JNIEnv*, char const*)+36)
	 #02 pc 0007e3c1  /data/app/com.something-2/lib/arm/libobjectbox.so
	 #03 pc 0007e073  /data/app/com.something-2/lib/arm/libobjectbox.so
	 #04 pc 00090277  /data/app/com.something-2/lib/arm/libobjectbox.so
	 #05 pc 00084e8f  /data/app/com.something-2/lib/arm/libobjectbox.so (Java_io_objectbox_query_Query_nativeFind+94)
	 #06 pc 00a835b7  /data/dalvik-cache/arm/data@[email protected]@[email protected]
 
 stack:
		  90f3e490  b4ebf4d0  /system/lib/libart.so
		  90f3e494  b4ebecbc  /system/lib/libart.so
		  90f3e498  b4ebecd0  /system/lib/libart.so
		  90f3e49c  b4efbba8  /system/lib/libart.so
		  90f3e4a0  00000000  
		  90f3e4a4  00550000  
		  90f3e4a8  90f3e4d8  [stack:10486]
		  90f3e4ac  00550000  
		  90f3e4b0  00430000  
		  90f3e4b4  b4ebf4d0  /system/lib/libart.so
		  90f3e4b8  b4ebf4d0  /system/lib/libart.so
		  90f3e4bc  b4ebecbc  /system/lib/libart.so
		  90f3e4c0  b4ebecd0  /system/lib/libart.so
		  90f3e4c4  0000003b  
		  90f3e4c8  00000000  
		  90f3e4cc  00550000  
		  90f3e4d0  9fc70400  [anon:libc_malloc]
		  90f3e4d4  00550000  
		  90f3e4d8  00430000  
		  90f3e4dc  afc2a0f0  [anon:libc_malloc]
		  90f3e4e0  00000001  
		  90f3e4e4  0040000d  
		  90f3e4e8  b4efac64  /system/lib/libart.so
		  90f3e4ec  b4dab86b  /system/lib/libart.so (art::JNI::NewStringUTF(_JNIEnv*, char const*)+298)
		  90f3e4f0  780cc278  /dev/ashmem/dalvik-alloc space (deleted)
		  90f3e4f4  00000043  
		  90f3e4f8  9fc70400  [anon:libc_malloc]
		  90f3e4fc  00000000  
		  90f3e500  00000000  
		  90f3e504  00000000  
		  90f3e508  b4ebff10  /system/lib/libart.so
		  90f3e50c  b4cb54cd  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckEbPKcz.constprop.128+192)
	 #00  90f3e510  12c35320  /dev/ashmem/dalvik-main space (deleted)
		  90f3e514  b4dbe127  /system/lib/libart.so (art::JNI::SetObjectField(_JNIEnv*, _jobject*, _jfieldID*, _jobject*)+346)
		  90f3e518  00000000  
		  90f3e51c  b6f49e04  
		  90f3e520  b4ebfff9  /system/lib/libart.so
		  90f3e524  b4ebfce4  /system/lib/libart.so
		  90f3e528  b4ebfd3c  /system/lib/libart.so
		  90f3e52c  b4eb

@LeeKingHung
Copy link
Author

LeeKingHung commented Jul 12, 2018

Possible to have any temp solution for this? It always crashes the app after the first crash.

@greenrobot
Copy link
Member

Investigated code that might be related, and did some minor improvements. Probably won't fix much. Could you reach out to me to arrange a solution: [my first name] ät objectbox dot io

@greenrobot
Copy link
Member

If you have time, could you share another crash log with 2.0.0-beta2? Thanks!

@LeeKingHung
Copy link
Author

I have emailed you for that. Thanks.

So far I only encountered this issue once with 2.0.0-beta (not 2). I will use beta2 and continue to observe.

@LeeKingHung
Copy link
Author

The error happened again: (Version: 2.1 and 2.2)

Please see the error log below:

2018-10-17 14:28:36.883 916-916/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2018-10-17 14:28:36.883 916-916/? A/DEBUG: Build fingerprint: 'samsung/nobleltedv/noblelte:7.0/NRD90M/N920IDVU3CQL3:user/release-keys'
2018-10-17 14:28:36.884 916-916/? A/DEBUG: Revision: '9'
2018-10-17 14:28:36.884 916-916/? A/DEBUG: ABI: 'arm'
2018-10-17 14:28:36.884 916-916/? A/DEBUG: pid: 32100, tid: 912, name: pool-8-thread-1  >>> com.something <<<
2018-10-17 14:28:36.884 916-916/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xa69adda4
2018-10-17 14:28:36.884 916-916/? A/DEBUG:     r0 00000005  r1 bbe06fc0  r2 00100009  r3 c76fa4f0
2018-10-17 14:28:36.884 916-916/? A/DEBUG:     r4 00000004  r5 00000006  r6 00000000  r7 9b3777e8
2018-10-17 14:28:36.884 916-916/? A/DEBUG:     r8 e19f6ca4  r9 bbe06fc0  sl e152e8ac  fp 00000000
2018-10-17 14:28:36.884 916-916/? A/DEBUG:     ip a69adda4  sp 9b3777b8  lr e152e8ac  pc c78581d4  cpsr 800f0030
2018-10-17 14:28:36.888 916-916/? A/DEBUG: backtrace:
2018-10-17 14:28:36.894 916-916/? A/DEBUG:     #00 pc 0003a1d4  /data/app/com.something-2/lib/arm/libobjectbox-jni.so
2018-10-17 14:28:36.894 916-916/? A/DEBUG:     #01 pc 000399f5  /data/app/com.something-2/lib/arm/libobjectbox-jni.so
2018-10-17 14:28:36.894 916-916/? A/DEBUG:     #02 pc 0004ee77  /data/app/com.something-2/lib/arm/libobjectbox-jni.so
2018-10-17 14:28:36.894 916-916/? A/DEBUG:     #03 pc 0004c25b  /data/app/com.something-2/lib/arm/libobjectbox-jni.so (Java_io_objectbox_query_Query_nativeFind+94)
2018-10-17 14:28:36.894 916-916/? A/DEBUG:     #04 pc 0119d7b3  /data/app/com.something-2/oat/arm/base.odex (offset 0xfd0000)

@greenrobot-team greenrobot-team self-assigned this Oct 29, 2018
@greenrobot-team
Copy link
Member

Tried to reproduce this with the info sent via email, but no luck.

@LeeKingHung Can you look at the code in my example below and maybe update it, so it works more like what you are doing?

493FindNativeCrash.zip

(Note: you can use File > Export to Zip File in Android Studio to export.)
-ut

@LeeKingHung
Copy link
Author

LeeKingHung commented Oct 31, 2018

I tried to update your codes, and could not reproduce, too.

However, the more I ran the app, the longer it took to run the db operation (about 30 seconds for 2000-object query).

The crash did not always happen, I also could not reproduce it using the codes in my project (I uninstalled and reinstall the app, the crash did not happen then. I guess it might happen only when the database size is large and the app is used for many times)

Maybe the issue comes from the number of properties for one entity instead of number of data for one entity? In my update codes (below link), I have more than 20 properties.

493FindNativeCrashV2.zip

@LeeKingHung
Copy link
Author

LeeKingHung commented Oct 31, 2018

This the objectbox stat from one device that encounters the crash.

capture

Hope that helps as I don't understand that.

@LeeKingHung
Copy link
Author

LeeKingHung commented Oct 31, 2018

Update:

After I changed the query limit from 2000 to 2, it worked without crash. However, it was extremely slow ( more than 2 seconds ).

Then I changed back to 2000 and tried, the speed was very slow too but the crashed did not happen (the output size is less than 1000).

Other than that, it seemed that some other queries (other parts from my project) were very slow as well.

@greenrobot-team
Copy link
Member

@LeeKingHung I noticed you are setting maxSizeInKByte(10 * 1024 * 1024) just as in #462. What device are you using to test this? I for one don't have one with that much (10 gigabytes) free space.

An emulator may work, but only if you customize the default size.

Also .maxReaders(5000) seems way too much.
-ut

@greenrobot-team
Copy link
Member

After reducing to put 10000 entities, but keeping maxSize 10G and maxReaders 5000 and running on a too small Android P emulator I get a crash when querying. Though the database size is just ~120MB.

    --------- beginning of crash
/example.com.a493findnativecrash A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xceb6b04c in tid 8988 (pool-1-thread-8), pid 8961 (findnativecrash)
/? I/crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
/? I//system/bin/tombstoned: received crash request for pid 8988
/? I/crash_dump32: performing dump of process 8961 (target tid = 8988)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86:9/PSR1.180720.061/5075414:userdebug/dev-keys'
Revision: '0'
ABI: 'x86'
pid: 8961, tid: 8988, name: pool-1-thread-8  >>> example.com.a493findnativecrash <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xceb6b04c
    eax f1e41050  ebx ceb6b04c  ecx 00000004  edx f1e4101a
    edi f1e4104c  esi d7f7e3a0
    ebp d104cfa8  esp d104cf60  eip d9323b82
backtrace:
    #00 pc 00072b82  /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/lib/x86/libobjectbox-jni.so
    #01 pc 00072b0a  /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/lib/x86/libobjectbox-jni.so
    #02 pc 0006bae7  /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/lib/x86/libobjectbox-jni.so
    #03 pc 00066180  /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/lib/x86/libobjectbox-jni.so
    #04 pc 00065b81  /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/lib/x86/libobjectbox-jni.so
    #05 pc 00037999  /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/lib/x86/libobjectbox-jni.so (Java_io_objectbox_query_Query_nativeFind+137)
    #06 pc 005f6b97  /system/lib/libart.so (art_quick_generic_jni_trampoline+71)
    #07 pc 005f0b82  /system/lib/libart.so (art_quick_invoke_stub+338)
    #08 pc 000a30ce  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+222)
    #09 pc 0029bca2  /system/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+338)
    #10 pc 00295246  /system/lib/libart.so (bool art::interpreter::DoCall<true, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1014)
    #11 pc 005be028  /system/lib/libart.so (MterpInvokeVirtualRange+664)
    #12 pc 005e3021  /system/lib/libart.so (ExecuteMterpImpl+15009)
    #13 pc 0014b4f4  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk!classes2.dex (deleted) (io.objectbox.query.Query$4.call+32)
    #14 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #15 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #16 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #17 pc 005bc493  /system/lib/libart.so (MterpInvokeVirtual+691)
    #18 pc 005e2d21  /system/lib/libart.so (ExecuteMterpImpl+14241)
    #19 pc 0014b4b8  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk!classes2.dex (deleted) (io.objectbox.query.Query$4.call)
    #20 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #21 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #22 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #23 pc 005bd574  /system/lib/libart.so (MterpInvokeInterface+1444)
    #24 pc 005e2f21  /system/lib/libart.so (ExecuteMterpImpl+14753)
    #25 pc 001436f8  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk!classes2.dex (deleted) (io.objectbox.BoxStore.callInReadTx+212)
    #26 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #27 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #28 pc 00295229  /system/lib/libart.so (bool art::interpreter::DoCall<true, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+985)
    #29 pc 005be028  /system/lib/libart.so (MterpInvokeVirtualRange+664)
    #30 pc 005e3021  /system/lib/libart.so (ExecuteMterpImpl+15009)
    #31 pc 00143758  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk!classes2.dex (deleted) (io.objectbox.BoxStore.callInReadTxWithRetry+12)
    #32 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #33 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #34 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #35 pc 005bc493  /system/lib/libart.so (MterpInvokeVirtual+691)
    #36 pc 005e2d21  /system/lib/libart.so (ExecuteMterpImpl+14241)
    #37 pc 0014dade  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk!classes2.dex (deleted) (io.objectbox.query.Query.callInReadTx+14)
    #38 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #39 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #40 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #41 pc 005bc493  /system/lib/libart.so (MterpInvokeVirtual+691)
    #42 pc 005e2d21  /system/lib/libart.so (ExecuteMterpImpl+14241)
    #43 pc 0014dbc0  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk!classes2.dex (deleted) (io.objectbox.query.Query.find+24)
    #44 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #45 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #46 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #47 pc 005bc493  /system/lib/libart.so (MterpInvokeVirtual+691)
    #48 pc 005e2d21  /system/lib/libart.so (ExecuteMterpImpl+14241)
    #49 pc 0001377c  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk (deleted) (example.com.a493findnativecrash.MainActivity$onCreate$2$1$1.run+88)
    #50 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #51 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #52 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #53 pc 005bd574  /system/lib/libart.so (MterpInvokeInterface+1444)
    #54 pc 005e2f21  /system/lib/libart.so (ExecuteMterpImpl+14753)
    #55 pc 0014422a  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk!classes2.dex (deleted) (io.objectbox.BoxStore.runInReadTx+38)
    #56 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #57 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #58 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #59 pc 005bc493  /system/lib/libart.so (MterpInvokeVirtual+691)
    #60 pc 005e2d21  /system/lib/libart.so (ExecuteMterpImpl+14241)
    #61 pc 00013962  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/example.com.a493findnativecrash-QooKiF8oFAOAK2Z5UZATJQ==/base.apk (deleted) (example.com.a493findnativecrash.MainActivity$onCreate$2$1.run+34)
    #62 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #63 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #64 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #65 pc 005bd574  /system/lib/libart.so (MterpInvokeInterface+1444)
    #66 pc 005e2f21  /system/lib/libart.so (ExecuteMterpImpl+14753)
    #67 pc 00117114  /system/framework/boot.vdex (java.util.concurrent.ThreadPoolExecutor.runWorker+162)
    #68 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #69 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #70 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #71 pc 005bc493  /system/lib/libart.so (MterpInvokeVirtual+691)
    #72 pc 005e2d21  /system/lib/libart.so (ExecuteMterpImpl+14241)
    #73 pc 00116442  /system/framework/boot.vdex (java.util.concurrent.ThreadPoolExecutor$Worker.run+4)
    #74 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #75 pc 0026c79c  /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220)
    #76 pc 00293e2b  /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019)
    #77 pc 005bd574  /system/lib/libart.so (MterpInvokeInterface+1444)
    #78 pc 005e2f21  /system/lib/libart.so (ExecuteMterpImpl+14753)
    #79 pc 000ca806  /system/framework/boot.vdex (java.lang.Thread.run+12)
    #80 pc 00266216  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598)
    #81 pc 0026c68e  /system/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+126)
    #82 pc 005a953d  /system/lib/libart.so (artQuickToInterpreterBridge+1277)
    #83 pc 005f6c6d  /system/lib/libart.so (art_quick_to_interpreter_bridge+77)
    #84 pc 005f0b82  /system/lib/libart.so (art_quick_invoke_stub+338)
    #85 pc 000a30ce  /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+222)
    #86 pc 004d3349  /system/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+89)
    #87 pc 004d45f7  /system/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+471)
    #88 pc 0050958c  /system/lib/libart.so (art::Thread::CreateCallback(void*)+1484)
    #89 pc 0008f065  /system/lib/libc.so (__pthread_start(void*)+53)
    #90 pc 0002485b  /system/lib/libc.so (__start_thread+75)

@greenrobot-team
Copy link
Member

greenrobot-team commented Nov 6, 2018

OK, could narrow it down by removing code that does not affect the crash (pretty much all of it, including maxSize/maxReaders; just kept put and the query).

The crash occurs if find limit is 5 or more, but not if 4 or less.
With find limit at 5: the crash occurs if inserting 6545 or more entities, but not 6544 or less.

With 6544 entities: the database size is around 80MB, so not the issue. And the limit can again be increased without crash. Also, inserting less data (not setting all properties) avoids the crash.

So there is definitely a bug there, will continue working on a test case.

update: added concrete values (see above).

update: minimal repro code
493FindNativeCrashV4.zip

-ut

@greenrobot-team greenrobot-team added bug Something isn't working and removed need to investigate labels Nov 6, 2018
@LeeKingHung
Copy link
Author

Thanks for finding out the bug! =)

I have large number of max readers and max db size just to prevent from reaching the limit. I do not actually need that much.

Now I use 500 max readers and 5GB max db size.

@LeeKingHung
Copy link
Author

FYI, If crash did not occur, the extreme slowness would be observed (even the limit is less than 10).

@greenrobot-team
Copy link
Member

@LeeKingHung Working on resolving the crash.

About the slowness: if you use 5GB or even 10GB as the upper limit, are you making sure that the affected devices actually have that much disk space available? Operations slowing down sounds very much like a device low on storage.
-ut

@LeeKingHung
Copy link
Author

LeeKingHung commented Nov 14, 2018

Yes, all devices have more than 12GB available space.
Also, the db size is less than 4GB.

Does the upper limit depend on the available space? I thought only the current db size depends on it.

@LeeKingHung
Copy link
Author

Hi is there any temporary solution to avoid this error? It keeps crashing.........

@greenrobot-team
Copy link
Member

Hi is there any temporary solution to avoid this error? It keeps crashing.........

Sorry, none that we know of.
-ut

@LeeKingHung
Copy link
Author

LeeKingHung commented Nov 21, 2018

No worries.
I used findIds() instead and now there is no crash observed.

By the way I noticed something, not sure it is related to this issue or not:
I ran the original query in one thread, and then ran another query (same box but differerent query) in another thread ( both queries were read query and were wrapped in BoxStore.runInReadTx() ), the crash would always happen.

@LeeKingHung
Copy link
Author

Is there any estimation of the release time of the fix ?

@frankqianghe
Copy link

frankqianghe commented Dec 3, 2018

I got the same crash on many devices. huawei,xiaomi,samsung. And the same log "Java_io_objectbox_query_Query_nativeFind+72" and I didn't insert any data, just query,when I got the crash. my objectbox version is 2.2.0

@greenrobot-team
Copy link
Member

This issue has been shared with the development team. As always, I can't give estimates on a fix. -ut

@greenrobot
Copy link
Member

@LeeKingHung, @frankqianghe I'm currently investigating this. Does the issue occur on both 32 and 64 bit configurations? Note that a CPU may be capable of 64 bit, but it is up to the OS to actually use it.

I saw ABI: 'arm' only in your reports and not arm64....

@greenrobot
Copy link
Member

Due to my findings, I assume this it limited to 32 bit and large objects.

@greenrobot
Copy link
Member

A fix is confirmed internally. It required extensive changes and we will do some additional tests for the upcoming release.

@LeeKingHung
Copy link
Author

How to check whether it is 32 bit or 64 bit ?

@greenrobot greenrobot added this to the 2.3.0 milestone Dec 30, 2018
@greenrobot
Copy link
Member

@LeeKingHung You have to check the device.

The just released version 2.3.0 should fix this. Please verify and let us know. Thank you!

@sebastianharder
Copy link

I have one affected user (10 crashes) on a Samsung Galaxy Note5 (noblelte), 3840MB RAM, Android 7.0.

It's the first time, I see this on the developer console after upgrading to ObjectBox 2.5.1.

  #00  pc 00000000000a3e3c  /data/app/com.xxx.android-2/lib/arm64/libobjectbox-jni.so
  #01  pc 0000000000048930  /data/app/com.xxx.android-2/lib/arm64/libobjectbox-jni.so (Java_io_objectbox_query_Query_nativeFind+1680)
  #02  pc 0000000001e37b30  /data/app/com.xxx.android-2/oat/arm64/base.odex (offset 0x1b2c000)```

@Oo121oO
Copy link

Oo121oO commented Aug 5, 2020

any update?it's still there.

1 #00 pc 00042a20 /system/lib/libc.so (tgkill+12) [armeabi-v7a]

#1 pc 000410b1 /system/lib/libc.so (pthread_kill+32) [armeabi-v7a]
#2 pc 0001c82b /system/lib/libc.so (raise+10) [armeabi-v7a]
#3 pc 000199dd /system/lib/libc.so (__libc_android_abort+34) [armeabi-v7a]
#4 pc 00017590 /system/lib/libc.so (abort+4) [armeabi-v7a]
#5 pc 00313f35 /system/lib/libart.so (art::Runtime::Abort()+212) [armeabi-v7a]
#6 pc 000e5e59 /system/lib/libart.so (art::LogMessage::~LogMessage()+2092) [armeabi-v7a]
#7 pc 002420fb /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1686) [armeabi-v7a]
#8 pc 002424e3 /system/lib/libart.so (art::JavaVMExt::JniAbortF(char const*, char const*, ...)+62) [armeabi-v7a]
10 #9 pc 00264bf7 /system/lib/libart.so (art::ReportInvalidJNINativeMethod(art::ScopedObjectAccess const&, art::mirror::Class*, char const*, int, bool)+114) [armeabi-v7a]
11 #10 pc 0001f0e1 /data/app/com.gmlive.soulmatch-1/lib/arm/libobjectbox-jni.so [armeabi-v7a]
12 #11 pc 0001e85f /data/app/com.gmlive.soulmatch-1/lib/arm/libobjectbox-jni.so [armeabi-v7a]
13 #12 pc 00034f49 /data/app/com.gmlive.soulmatch-1/lib/arm/libobjectbox-jni.so [armeabi-v7a]
14 #13 pc 00033585 /data/app/com.gmlive.soulmatch-1/lib/arm/libobjectbox-jni.so (Java_io_objectbox_query_Query_nativeFind+952) [armeabi-v7a]
15 #14 pc 032820c3 /data/app/com.gmlive.soulmatch-1/oat/arm/base.odex (oatexec+21291203) [armeabi]
16 java:
17 [Failed to get Java stack]

@greenrobot
Copy link
Member

@Oo121oO It's probably another issue as the native stack looks different. Could you open a new issue with some more details, so this is not lost? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants