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

App crashes with "JNI ERROR (app bug): local reference table overflow (max=512)" #7262

Closed
tejas-n opened this issue Jan 7, 2021 · 10 comments
Labels
Blocked This issue is blocked by another issue O-Community Reproduction-Required

Comments

@tejas-n
Copy link

tejas-n commented Jan 7, 2021

We noticed that our app crashes sometimes with "JNI ERROR (app bug): local reference table overflow (max=512)". Can you tell us what might be happening, please? We had reported a similar error at #7217 but it was fixed and we haven't experienced that error after the new update. This one looks similar to that but the source of this one seems different though.

Version of Realm and tooling

Realm version(s): 10.2.0

Realm Sync feature enabled: Yes

Android Studio version: 4.1.1

Android Build Tools version: 30.0.2

Gradle version: Android Gradle Plugin 4.1.1 with Gradle 6.5

Which Android version and device(s): A custom Android tablet which runs Android 7.1.2

Logs

********** Crash dump: **********
Build fingerprint: 'Android/tab173_rk_gen2/tab173_rk_gen2:7.1.2/2.0/buildk11202149:user/release-keys'
Abort message: 'art/runtime/indirect_reference_table.cc:132] JNI ERROR (app bug): local reference table overflow (max=512)'
#00 0x0004a0c0 /system/lib/libc.so (tgkill+12)
#01 0x00047853 /system/lib/libc.so (pthread_kill+34)
#02 0x0001d8b5 /system/lib/libc.so (raise+10)
#03 0x00019401 /system/lib/libc.so (__libc_android_abort+34)
#04 0x00017048 /system/lib/libc.so (abort+4)
#05 0x0031d8cd /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+328)
#06 0x000b5503 /system/lib/libart.so (_ZN3art10LogMessageD2Ev+1134)
#07 0x001bd92f /system/lib/libart.so (_ZN3art22IndirectReferenceTable3AddEjPNS_6mirror6ObjectE+194)
#08 0x002660d7 /system/lib/libart.so (_ZN3art3JNI10NewObjectVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+478)
#09 0x00013565 /system/lib/libjavacore.so
#10 0x0001d055 /system/lib/libjavacore.so
#11 0x0001d341 /system/lib/libjavacore.so
#12 0x00018a09 /system/lib/libjavacore.so
#13 0x0067e62b /system/framework/arm/boot-core-libart.oat (offset 0x47d000) (libcore.io.Posix.android_getaddrinfo+126)
#14 0x00670c43 /system/framework/arm/boot-core-libart.oat (offset 0x47d000) (libcore.io.ForwardingOs.android_getaddrinfo+62)
#15 0x005c4081 /system/framework/arm/boot.oat (offset 0x51b000) (java.net.InetAddress.parseNumericAddressNoThrow+268)
#16 0x005c3de1 /system/framework/arm/boot.oat (offset 0x51b000) (java.net.InetAddress.isNumeric+44)
#17 0x0009cfb7 /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.Platform.isLiteralIpAddress+42)
#18 0x0006c46d /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.AddressUtils.isValidSniHostname+80)
#19 0x0009cef7 /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.Platform.getSSLParameters+154)
#20 0x000941c5 /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.OpenSSLSocketImpl.getSSLParameters+72)
#21 0x000a3ccf /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer+106)
#22 0x01cd21b3 /system/framework/arm/boot-framework.oat (offset 0x15cb000) (android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted+54)
#23 0x01cd2d67 /system/framework/arm/boot-framework.oat (offset 0x15cb000) (android.security.net.config.RootTrustManager.checkServerTrusted+250)
#24 0x0009c793 /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.Platform.checkServerTrusted+246)
#25 0x00095e29 /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain+540)
#26 0x000a99c1 /system/lib/libart.so (art_quick_invoke_stub_internal+64)
#27 0x00409185 /system/lib/libart.so (art_quick_invoke_stub+232)
#28 0x000b0c89 /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+136)
#29 0x003187c3 /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
#30 0x00319755 /system/lib/libart.so (_ZN3art35InvokeVirtualOrInterfaceWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+256)
#31 0x0026be0d /system/lib/libart.so (_ZN3art3JNI15CallVoidMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+444)
#32 0x00011939 /system/lib/libjavacrypto.so
#33 0x00011ef5 /system/lib/libjavacrypto.so
#34 0x00016f7f /system/lib/libssl.so
#35 0x0000feed /system/lib/libssl.so
#36 0x0000f0a7 /system/lib/libssl.so
#37 0x0000e8dd /system/lib/libjavacrypto.so
#38 0x0007888f /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.NativeCrypto.SSL_do_handshake+210)
#39 0x0009556d /system/framework/arm/boot-conscrypt.oat (offset 0x6b000) (com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake+1072)
#40 0x0005863f /dev/ashmem/dalvik-jit-code-cache (deleted)
@tejas-n
Copy link
Author

tejas-n commented Jan 7, 2021

Posting more logs in case you find it useful. We found this before the logs that I posted previously

01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427] JNI ERROR (app bug): local reference table overflow (max=512)
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427] local reference table dump:
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]   Last 10 entries (of 512):
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       511: 0x332be698 java.lang.String "android_getaddri... (19 chars)
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       510: 0x32dd0448 java.lang.String "ECDHE_RSA"
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       509: 0x33192740 long[] (2 elements)
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       508: 0x7123d2d8 java.lang.Class<com.android.org.conscrypt.OpenSSLSocketImplWrapper>
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       507: 0x7123d2d8 java.lang.Class<com.android.org.conscrypt.OpenSSLSocketImplWrapper>
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       506: 0x333919d0 java.lang.String ""
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       505: 0x3314edf0 java.lang.String "https://ap-south... (73 chars)
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       504: 0x332b60b8 java.lang.String "post"
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       503: 0x3328fc00 io.realm.internal.network.OkHttpNetworkTransport$Response
01-06 21:05:00.373  2260  2307 F art     : art/runtime/runtime.cc:427]       502: 0x33373340 java.lang.String[] (12 elements)
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]   Summary:
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]       129 of java.lang.Class (3 unique instances)
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]       126 of io.realm.internal.network.OkHttpNetworkTransport (1 unique instances)
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]       125 of io.realm.internal.network.OkHttpNetworkTransport$Response (125 unique instances)
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]       125 of java.lang.String[] (12 elements) (125 unique instances)
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]         5 of java.lang.String (5 unique instances)
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]         1 of long[] (2 elements)
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]         1 of java.util.HashMap
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427] 
01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427] 

@nhachicha
Copy link
Collaborator

Hi @tejas-n we fixed this in #7232 and was released in 10.2.0 are you sure the APK reporting this is using this version? Could you share the complete crash log? there's no particular Realm reference (like librealm-jni.so) within the stack trace ...

@tejas-n
Copy link
Author

tejas-n commented Jan 14, 2021

Thanks for the reply, @nhachicha. Those are the complete logs that we had. Unfortunately, we are missing the version info but we think it was 10.2.0 since it had been deployed for a while.
But I'll keep an eye out to see if we encounter that again.

What do you think about the 503: 0x3328fc00 io.realm.internal.network.OkHttpNetworkTransport$Response reference? Is that relevant?

@sync-by-unito sync-by-unito bot changed the title App crashes with "JNI ERROR (app bug): local reference table overflow (max=512)" App crashes with "JNI ERROR (app bug): local reference table overflow (max=512)" Jan 14, 2021
@rorbech
Copy link
Collaborator

rorbech commented Jan 25, 2021

@tejas-n It seems a bit suspicious with

01-06 21:05:00.374  2260  2307 F art     : art/runtime/runtime.cc:427]       125 of io.realm.internal.network.OkHttpNetworkTransport$Response (125 unique instances)

Are you doing any particular stuff related to networking (configuration/proxy/redirecting)? Maybe try to enable some additional logging with RealmLog.setLevel(LogLevel.ALL) to shed light on if there are any unforeseen network requests. Or maybe try to outline the overall realm usage of the app.

Could you also share a bit about the specs of the device?

@tejas-n
Copy link
Author

tejas-n commented Feb 10, 2021

Thanks for the response and sorry for the late reply. I am no longer working on that project but if it helps, I can give you some more details.
Our apps were running on a custom Android tablet which ran Android 7.1.2.

Our devices were being used by people in a retirement village which had it's own private network which connected to the Internet so I'm not sure how their network was configured. I'm not sure if this is related but we were also frequently seeing DNS renewal issues at that time:

01-05 08:38:53.627 437 29361 D DhcpClient: Received packet: 00:e0:4e:69:af:ec ACK: your new IP /10.10.10.152, netmask /255.255.255.0, gateways [/10.10.10.1] DNS servers: /10.10.10.1 /1.1.1.2 , lease time 600

Our logs were flooded with these statements at that time. Anyways, l am no longer working on that project but posted if it could help you all debug the issue.

@rorbech
Copy link
Collaborator

rorbech commented Feb 22, 2021

@tejas-n Thanks for the additional input.

Usually you only see these errors on low-memory devices. Further, it looks to be related to the network usage, but with custom device, the very short lease time and potential other network configuration unknowns and without a chance to get more insight/reproduce I don't think we can get to the bottom of this.

I will leave it hanging for now, but please please feel free to add additional insight if something pops up.

@sync-by-unito sync-by-unito bot added the Blocked This issue is blocked by another issue label Feb 22, 2021
@bmunkholm
Copy link
Contributor

Closing as we can't get further without more details.

@Wedmal
Copy link

Wedmal commented Feb 1, 2022

My Android Unity app has this issue when trying to make network requests.
I make a request every second after processing, and after a few hours of work I get an error. Windows doesn't have this problem, Linux doesn't.
This problem is also in android 5.1.
RAM = 2 GB
cpu rk3288
We use different networks. Lan, wifi, mobile 3G, 2G - all this is not the essence of the problem

@cmelchior
Copy link
Contributor

@Wedmal Can you create a new issue with the details. If you also have a stacktrace that would be invaluable.

@Wedmal
Copy link

Wedmal commented Feb 1, 2022

@Wedmal Можете ли вы создать новую проблему с подробностями. Если у вас также есть трассировка стека, это было бы неоценимо.

it has nothing to do with Realm-Java.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Blocked This issue is blocked by another issue O-Community Reproduction-Required
Projects
None yet
Development

No branches or pull requests

6 participants