Question: Pushwoosh setTags API APP crashes when setting list tag with approx 1600 tags. How do I solve it?
Answer: If you have this error with a stacktrace similar to the one below, this is actually a known issue in React Native itself:
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] local reference table dump:
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] Last 10 entries (of 507):
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 506: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 505: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 504: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 503: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 502: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 501: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 500: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.895 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 499: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 498: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 497: 0x1337cda0 com.facebook.react.bridge.ReadableType
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] Summary:
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 1 of com.facebook.react.bridge.ReadableNativeArray
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 504 of com.facebook.react.bridge.ReadableType (1 unique instances)
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 1 of java.lang.Object[] (3600 elements)
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115] 1 of java.lang.Thread
08-27 10:34:50.896 25537 25609 F art : art/runtime/indirect_reference_table.cc:115]
08-27 10:34:51.416 25537 25609 F art : art/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
08-27 10:34:51.416 25537 25609 F art : art/runtime/runtime.cc:366] Runtime aborting --- recursively, so no thread-specific detail!
08-27 10:34:51.416 25537 25609 F art : art/runtime/runtime.cc:366]
--------- beginning of crash
08-27 10:34:51.416 25537 25609 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 25609 (mqt_native_modu)
08-27 10:34:51.528 195 195 I SELinux : SELinux: Loaded file_contexts contexts from /file_contexts.
08-27 10:34:51.531 195 195 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-27 10:34:51.531 195 195 F DEBUG : Build fingerprint: 'google/hammerhead/hammerhead:6.0.1/MMB29S/2489379:user/release-keys'
08-27 10:34:51.531 195 195 F DEBUG : Revision: '0'
08-27 10:34:51.531 195 195 F DEBUG : ABI: 'arm'
08-27 10:34:51.531 195 195 F DEBUG : pid: 25537, tid: 25609, name: mqt_native_modu >>> com.demoapp <<<
08-27 10:34:51.531 195 195 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
08-27 10:34:51.563 195 195 F DEBUG : Abort message: 'art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)'
08-27 10:34:51.563 195 195 F DEBUG : r0 00000000 r1 00006409 r2 00000006 r3 9c220978
08-27 10:34:51.563 195 195 F DEBUG : r4 9c220980 r5 9c220930 r6 00000000 r7 0000010c
08-27 10:34:51.564 195 195 F DEBUG : r8 b4c7f800 r9 b4c7de44 sl 9d323f5b fp b4c63450
08-27 10:34:51.564 195 195 F DEBUG : ip 00000006 sp 9c21f6e0 lr b6cbfb61 pc b6cc1f50 cpsr 40070010
08-27 10:34:51.604 195 195 F DEBUG :
08-27 10:34:51.604 195 195 F DEBUG : backtrace:
08-27 10:34:51.604 195 195 F DEBUG : #00 pc 00041f50 /system/lib/libc.so (tgkill+12)
08-27 10:34:51.604 195 195 F DEBUG : #01 pc 0003fb5d /system/lib/libc.so (pthread_kill+32)
08-27 10:34:51.604 195 195 F DEBUG : #02 pc 0001c30f /system/lib/libc.so (raise+10)
08-27 10:34:51.604 195 195 F DEBUG : #03 pc 000194c1 /system/lib/libc.so (__libc_android_abort+34)
08-27 10:34:51.604 195 195 F DEBUG : #04 pc 000174ac /system/lib/libc.so (abort+4)
08-27 10:34:51.604 195 195 F DEBUG : #05 pc 00333971 /system/lib/libart.so (art::Runtime::Abort()+228)
08-27 10:34:51.604 195 195 F DEBUG : #06 pc 000f45fb /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
08-27 10:34:51.605 195 195 F DEBUG : #07 pc 000f08d1 /system/lib/libart.so (art::Barrier::~Barrier()+216)
08-27 10:34:51.605 195 195 F DEBUG : #08 pc 0035b473 /system/lib/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+162)
08-27 10:34:51.605 195 195 F DEBUG : #09 pc 00333a35 /system/lib/libart.so (art::Runtime::Abort()+424)
08-27 10:34:51.605 195 195 F DEBUG : #10 pc 000f45fb /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
08-27 10:34:51.605 195 195 F DEBUG : #11 pc 001de42d /system/lib/libart.so (art::IndirectReferenceTable::Add(unsigned int, art::mirror::Object*)+248)
08-27 10:34:51.605 195 195 F DEBUG : #12 pc 00272d9b /system/lib/libart.so (art::JNI::NewLocalRef(_JNIEnv*, _jobject*)+346)
08-27 10:34:51.605 195 195 F DEBUG : #13 pc 0010796f /system/lib/libart.so (art::CheckJNI::NewLocalRef(_JNIEnv*, _jobject*)+606)
08-27 10:34:51.605 195 195 F DEBUG : #14 pc 00026e69 /data/app/com.demoapp-1/lib/arm/libreactnativejni.so
08-27 10:34:51.605 195 195 F DEBUG : #15 pc 00026fa1 /data/app/com.demoapp-1/lib/arm/libreactnativejni.so
08-27 10:34:51.605 195 195 F DEBUG : #16 pc 00029faf /data/app/com.demoapp-1/lib/arm/libreactnativejni.so
08-27 10:34:51.605 195 195 F DEBUG : #17 pc 0002a40f /data/app/com.demoapp-1/lib/arm/libreactnativejni.so
08-27 10:34:51.605 195 195 F DEBUG : #18 pc 0002b1a3 /data/app/com.demoapp-1/lib/arm/libreactnativejni.so
08-27 10:34:51.605 195 195 F DEBUG : #19 pc 01636b21 /data/app/com.demoapp-1/oat/arm/base.odex (offset 0xc69000) (java.lang.Object[] com.facebook.react.bridge.ReadableNativeArray.importTypeArray()+76)
08-27 10:34:51.606 195 195 F DEBUG : #20 pc 0163666f /data/app/com.demoapp-1/oat/arm/base.odex (offset 0xc69000) (com.facebook.react.bridge.ReadableType[] com.facebook.react.bridge.ReadableNativeArray.getLocalTypeArray()+170)
08-27 10:34:51.606 195 195 F DEBUG : #21 pc 01637711 /data/app/com.demoapp-1/oat/arm/base.odex (offset 0xc69000) (com.facebook.react.bridge.ReadableType com.facebook.react.bridge.ReadableNativeArray.getType(int)+164)
08-27 10:34:51.606 195 195 F DEBUG : #22 pc 0130249b /data/app/com.demoapp-1/oat/arm/base.odex (offset 0xc69000) (org.json.JSONArray com.pushwoosh.reactnativeplugin.ConversionUtil.toArray(com.facebook.react.bridge.ReadableArray)+158)
08-27 10:34:51.606 195 195 F DEBUG : #23 pc 0130324f /data/app/com.demoapp-1/oat/arm/base.odex (offset 0xc69000) (org.json.JSONObject com.pushwoosh.reactnativeplugin.ConversionUtil.toJsonObject(com.facebook.react.bridge.ReadableMap)+1658)
08-27 10:34:51.606 195 195 F DEBUG : #24 pc 01302271 /data/app/com.demoapp-1/oat/arm/base.odex (offset 0xc69000) (com.pushwoosh.tags.TagsBundle com.pushwoosh.reactnativeplugin.ConversionUtil.convertToTagsBundle(com.facebook.react.bridge.ReadableMap)+100)
08-27 10:34:51.606 195 195 F DEBUG : #25 pc 01c1995f /data/app/com.demoapp-1/oat/arm/base.odex (offset 0xc69000) (void com.pushwoosh.reactnativeplugin.PushwooshPlugin.setTags(com.facebook.react.bridge.ReadableMap, com.facebook.react.bridge.Callback, com.facebook.react.bridge.Callback)+154)
By the time this article is created (React Native v0.56.0), the issue is still not fixed, however there is a stable workaround:
// Add these methods to your onCreate() in your MainApplication.java for your project
ReadableNativeArray.setUseNativeAccessor(true);
ReadableNativeMap.setUseNativeAccessor(true);
Please note that without calling SoLoader.init(this, /* native exopackage */ false);
these lines will crash your app:
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
// call for react native >= 0.54.0
ReadableNativeArray.setUseNativeAccessor(true);
ReadableNativeMap.setUseNativeAccessor(true);
}
}
Comments
0 comments
Please sign in to leave a comment.