Search Issue Tracker

Active

Fixed in 2023.3.0b7

Votes

2

Found in

2023.3.0a18

2024.1.0a1

Issue ID

UUM-59437

Regression

No

[Android] Crash on "/apex/com.android.runtime/lib64/bionic/libc.so (abort+168)" when the JNI table gets overflowed with java.lang.Integer and java.lang.Class<java.lang.Integer>

--

-

Reproduction steps:
1. Open the user’s attached “JNIExperiments” project
2. Build and run the Player (File > Build And Run)
3. Wait several minutes and observe the Player

Expected result: The Player does not crash
Actual result: The Player crashes

Reproducible environment: macOS 14.1.2 Sonoma (Intel), macOS 14.1.1 Sonoma (M2 (user’s))
Not reproducible environment: No other environment tested

Reproducible with: 2023.2.4f1
Could not test with: 2021.3.33f1, 2022.3.16f1, 2023.3.0b1 (“What went wrong: Execution failed for task ':unityLibrary:compileDebugJavaWithJavac'.” build error)

Reproducible with these devices:
VLNQA00175, Samsung Galaxy Note9 (SM-N960F), Android 10, CPU: Exynos 9 (9810), GPU: Mali-G72
VLNQA00519, Google Pixel 4 (Pixel 4), Android 12, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
VLNQA00057, Htc One M9+ (HTC_M9pw), Android 6.0, CPU: MediaTek Helio X10 MT6795T, GPU: PowerVR Rogue G6200
VLNQA00146, Htc 10 (HTC 10), Android 7.0, CPU: Snapdragon 820 MSM8996, GPU: Adreno (TM) 530
VLNQA00372, Samsung SM-G991U (SM-G991U), Android 12, CPU: Snapdragon 888, GPU: Adreno (TM) 660

Not reproducible with these devices:
VLNQA00494 - iPhone 14 Pro Max, 16.3.1 iOS
VLNQA00358 - iPhone 12, 14.1 iOS
VLNQA00392 - iPad (9th generation), 15.0 iOS
VLNQA00310 - iPad Pro 12.9", 13.4.1 iOS

Note: Not reproducible with macOS Standalone platform

First few lines of the stack trace:

{noformat}#00 pc 0000000000052654 /apex/com.android.runtime/lib64/bionic/libc.so (abort+168) (BuildId: df59110c25db9843852145a266abecf7)
#01 pc 00000000006d122c /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+704) (BuildId: a49c773ef6221a996ecea990e9753caa)
#02 pc 0000000000016ea8 /apex/com.android.art/lib64/libbase.so (BuildId: 420d56eac27a210c92900f3ddb760c86)
#03 pc 0000000000016450 /apex/com.android.art/lib64/libbase.so (android::base::LogMessage::~LogMessage()+352) (BuildId: 420d56eac27a210c92900f3ddb760c86)
#04 pc 000000000045cacc /apex/com.android.art/lib64/libart.so (art::JavaVMExt::AddGlobalRef(art::Thread*, art::ObjPtr<art::mirror::Object>)+1908) (BuildId: a49c773ef6221a996ecea990e9753caa)
#05 pc 00000000005cf9b4 /apex/com.android.art/lib64/libart.so (art::JNI<false>::NewGlobalRef(_JNIEnv*, _jobject*)+152) (BuildId: a49c773ef6221a996ecea990e9753caa){noformat}

JNI Error:

{noformat}JNI ERROR (app bug): global reference table overflow (max=51200)global reference table dump:
51199: 0x6f4f1070 java.lang.Integer
51198: 0x6f5660f0 java.lang.Class<java.lang.Integer>{noformat}

  1. Resolution Note (fix version 2023.3.0b7):

    You need to call Dispose on AndroidJavaObjects passed to AndroidJavaProxy callback to avoid leakage.

    In future releases, we'll automatically Dispose such objects, we cannot introduce such change in Unity 2023.3 since it would be a breaking change.

Comments (1)

  1. Shefich

    Dec 29, 2023 20:33

    Hello, this probably this improvement should come to unity 2022.3.x, as I have too many such crashes on Android.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.