couchbase / couchbase-lite-android-ce

The community edition of couchbase lite for android
Apache License 2.0
9 stars 1 forks source link

local reference table overflow #15

Closed RocketRider closed 5 years ago

RocketRider commented 5 years ago

I am using the cbl 2.5 in an Android app. While testing I am syncing a DB with 25k documents from the server to the app. We have multible change listeners and querys active. After some time I receive the following native crash:

07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115] local reference table dump:
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]   Last 10 entries (of 512):
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       511: 0x14c63670 com.couchbase.litecore.C4DocumentEnded
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       510: 0x135a2dd0 java.lang.String "1-0eb679257d1cca... (42 chars)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       509: 0x144ef500 java.lang.String "mst_c9cc36e2-fab... (81 chars)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       508: 0x14c636a0 com.couchbase.litecore.C4DocumentEnded
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       507: 0x135a2eb0 java.lang.String "1-8aa87dac5541a2... (42 chars)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       506: 0x144ef5c0 java.lang.String "mst_7df37243-04d... (81 chars)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       505: 0x14c636d0 com.couchbase.litecore.C4DocumentEnded
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       504: 0x135a2f90 java.lang.String "1-89b70d91218a04... (42 chars)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       503: 0x144ef680 java.lang.String "mst_db1043c6-e98... (81 chars)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       502: 0x14c63700 com.couchbase.litecore.C4DocumentEnded
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]   Summary:
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]         1 of com.couchbase.litecore.C4DocumentEnded[] (176 elements)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       171 of com.couchbase.litecore.C4DocumentEnded (171 unique instances)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115]       340 of java.lang.String (340 unique instances)
07-01 08:52:39.739 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/indirect_reference_table.cc:115] 
07-01 08:52:41.840 ? E/RXNServices.SocketServer: java.io.IOException: socket failed: EMFILE (Too many open files)
07-01 08:52:50.653 xxx.yyy.zzzE/art: Unexpected time out during dump checkpoint.
07-01 08:52:50.653 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
07-01 08:52:50.653 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/runtime.cc:379] Runtime aborting --- recursively, so no thread-specific detail!
07-01 08:52:50.653 xxx.yyy.zzzA/art: vendor/intel/art-extension/runtime/runtime.cc:379] 
07-01 08:52:50.653 xxx.yyy.zzzA/libc: Fatal signal 6 (SIGABRT), code -6 in tid 16324 (Thread-72027)
07-01 08:52:50.705 ? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-01 08:52:50.705 ? A/DEBUG: Build fingerprint: 'panasonic/fz_a2aa/fz_a2a:6.0.1/MMB29M/V1.01L25M2310:user/release-keys'
07-01 08:52:50.705 ? A/DEBUG: Revision: '0'
07-01 08:52:50.705 ? A/DEBUG: ABI: 'x86'
07-01 08:52:50.706 ? A/DEBUG: pid: 15491, tid: 16324, name: Thread-72027  >>> xxx.yyy.zzz<<<
07-01 08:52:50.706 ? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
07-01 08:52:50.734 ? A/DEBUG: Abort message: 'vendor/intel/art-extension/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)'
07-01 08:52:50.734 ? A/DEBUG:     eax 00000000  ebx 00003c83  ecx 00003fc4  edx 00000006
07-01 08:52:50.734 ? A/DEBUG:     esi d9b41970  edi 0000006e
07-01 08:52:50.734 ? A/DEBUG:     xcs 00000023  xds 0000002b  xes 0000002b  xfs 000001ef  xss 0000002b
07-01 08:52:50.734 ? A/DEBUG:     eip ffffe440  ebp 00003fc4  esp d9b40f90  flags 00200296
07-01 08:52:50.740 ? A/DEBUG: backtrace:
07-01 08:52:50.740 ? A/DEBUG:     #00 pc 00000440  [vdso] (__kernel_vsyscall+16)
07-01 08:52:50.740 ? A/DEBUG:     #01 pc 000995f8  /system/lib/libc.so (tgkill+24)
07-01 08:52:50.740 ? A/DEBUG:     #02 pc 0009538c  /system/lib/libc.so (pthread_kill+76)
07-01 08:52:50.740 ? A/DEBUG:     #03 pc 00037915  /system/lib/libc.so (raise+37)
07-01 08:52:50.740 ? A/DEBUG:     #04 pc 00030255  /system/lib/libc.so (abort+85)
07-01 08:52:50.740 ? A/DEBUG:     #05 pc 00523004  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+388)
07-01 08:52:50.740 ? A/DEBUG:     #06 pc 00151b22  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+514)
07-01 08:52:50.740 ? A/DEBUG:     #07 pc 0014bd3b  /system/lib/libart.so (_ZN3art7BarrierD2Ev+971)
07-01 08:52:50.740 ? A/DEBUG:     #08 pc 0056f721  /system/lib/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+497)
07-01 08:52:50.740 ? A/DEBUG:     #09 pc 00523186  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+774)
07-01 08:52:50.740 ? A/DEBUG:     #10 pc 00151b22  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+514)
07-01 08:52:50.740 ? A/DEBUG:     #11 pc 002fc0f8  /system/lib/libart.so (_ZN3art22IndirectReferenceTable3AddEjPNS_6mirror6ObjectE+1128)
07-01 08:52:50.740 ? A/DEBUG:     #12 pc 00409501  /system/lib/libart.so (_ZN3art3JNI12NewStringUTFEP7_JNIEnvPKc+225)
07-01 08:52:50.740 ? A/DEBUG:     #13 pc 0017d6ff  /system/lib/libart.so (_ZN3art8CheckJNI12NewStringUTFEP7_JNIEnvPKc+319)
07-01 08:52:50.740 ? A/DEBUG:     #14 pc 000dca72  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZN8litecore3jni9toJStringEP7_JNIEnv7FLSlice+210)
07-01 08:52:50.740 ? A/DEBUG:     #15 pc 000d932d  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so
07-01 08:52:50.740 ? A/DEBUG:     #16 pc 000d8bf6  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so
07-01 08:52:50.740 ? A/DEBUG:     #17 pc 0012105a  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZN12C4Replicator24replicatorDocumentsEndedEPN8litecore4repl10ReplicatorERKNSt6__ndk16vectorIN6fleece8RetainedINS1_13ReplicatedRevEEENS4_9allocatorIS9_EEEE+410)
07-01 08:52:50.741 ? A/DEBUG:     #18 pc 001214fa  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZThn8_N12C4Replicator24replicatorDocumentsEndedEPN8litecore4repl10ReplicatorERKNSt6__ndk16vectorIN6fleece8RetainedINS1_13ReplicatedRevEEENS4_9allocatorIS9_EEEE+42)
07-01 08:52:50.741 ? A/DEBUG:     #19 pc 002849d9  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZN8litecore4repl10Replicator20notifyEndedDocumentsEv+121)
07-01 08:52:50.741 ? A/DEBUG:     #20 pc 00122900  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZNSt6__ndk110__function6__funcINS_6__bindIRMN8litecore4repl10ReplicatorEFvvEJPS5_EEENS_9allocatorISA_EEFvvEEclEv+48)
07-01 08:52:50.741 ? A/DEBUG:     #21 pc 002dcc0e  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZNK8litecore5actor15ThreadedMailbox10safelyCallERKNSt6__ndk18functionIFvvEEE+46)
07-01 08:52:50.741 ? A/DEBUG:     #22 pc 002de9db  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so
07-01 08:52:50.741 ? A/DEBUG:     #23 pc 002dc147  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZN8litecore5actor15ThreadedMailbox18performNextMessageEv+167)
07-01 08:52:50.741 ? A/DEBUG:     #24 pc 002dc02c  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so (_ZN8litecore5actor9Scheduler4taskEj+204)
07-01 08:52:50.741 ? A/DEBUG:     #25 pc 002dcd86  /data/app/xxx.yyy.zzz-2/lib/x86/libLiteCoreJNI.so
07-01 08:52:50.741 ? A/DEBUG:     #26 pc 00094739  /system/lib/libc.so (_ZL15__pthread_startPv+57)
07-01 08:52:50.741 ? A/DEBUG:     #27 pc 000312ea  /system/lib/libc.so (__start_thread+26)
07-01 08:52:50.741 ? A/DEBUG:     #28 pc 000175c6  /system/lib/libc.so (__bionic_clone+70)
bmeike commented 5 years ago

This issue is tracked here: https://issues.couchbase.com/browse/CBL-174

bmeike commented 5 years ago

After poking around at this for a while, I am given to suspect that the problem was caused by an attached Debugger. Apparently, the Debugger, in order to hold data in memory across breakpoints, creates at least local and sometimes global, references to them.

If you can come up with evidence that this is not related to a Debugger, I'd be very interested in seeing it. If you catch such an event, please include the full thread dump in the ticket.

bmeike commented 5 years ago

Hey @RocketRider , can you repo this without a debugger attached?

RocketRider commented 5 years ago

I am not sure if I had a debugger attached. But I will try it today without the debugger and will report back.

RocketRider commented 5 years ago

I tested it again with and without the debugger attached. And I could only reproduce the crash with the debugger attached. Without it worked fine. So I guess you are right to say it is a problem of the debugger. Thank you for looking into it.

bmeike commented 5 years ago

Awesome. Things we both learned! Closing.