-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Android ART Native Crash sometimes occurs when changing a threads name #2234
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
Comments
Hi, this is clearly an Android bug that should be reported to Google bug tracker, we cannot do much on our side here.
Yes, you can disable debug mode to workaround that problem. If this problem becomes too frequent and/or widespread, we'll consider adding a separate flag to disable thread renaming only. |
I do agree that it's ultimately an android issue and plan to file a bug there as well. But, since such a fix would take quite some time to propagat through the ecosystem, I think that a solution on the library side is sorta needed just due to practicality. I'll take a look at disabling debug mode and see if it resolves our problem (I've only seen this crash reported in the wild). Whether a separate flag is worth the effort may be a matter of how much pain we feel when debugging other production crash reports with the debug flag off. Thanks for your help! |
Thanks! Please keep us informed about this problem. Let's leave it open for a while to see if there are other similar reports |
Dunno if related, I also get a hard crash, but only from an app deployed to the app store. If the app is built locally it works fine (both in debug/release mode). My code uses coroutines.
|
I think it's same crash |
Mine is related to the R8 minifier (three shaking code it shouldnt), so I think my crash is unrelated to this. |
Did you solve the problem?How did you confirm that the problem was introduced by R8? |
We have the same stack trace, without using coroutines and only for Android 10 devices:
In fact, it was reported months ago here but according to this other issue comment, it looks like something that was solved for Android 11 onwards. |
Exactly the same crash as nimeacuerdo. Android 10 - 99.8 % Android 11 - 0.2 |
I am also facing the same not able to identify the issue. It occurs in production. |
Thanks for pointing it out, it seems it's worth adding a feature flag to disable thread name change. As a workaround, it's possible to disable the debug mode at all in the production builds to avoid that crash |
One more harmful evidence about this feature enabled by default, the following code is purely dominated by
|
Only occurs on android 10. Check failed: key_value != nullptr compiler-filter not found in oat header: |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
backtrace:
#00 pc 0x000000000008be20 /apex/com.android.runtime/lib64/bionic/libc.so (abort+168)
#01 pc 0x00000000006d29ec /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+704)
#02 pc 0x0000000000016ea8 /apex/com.android.art/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+80)
#03 pc 0x0000000000016450 /apex/com.android.art/lib64/libbase.so (android::base::LogMessage::~LogMessage()+352)
#04 pc 0x00000000006fe104 /apex/com.android.art/lib64/libart.so (art::ThreadSuspendByPeerWarning(art::Thread*, android::base::LogSeverity, char const*, _jobject*) (.__uniq.215660552210357940630679712151551015321)+552)
#05 pc 0x0000000000374048 /apex/com.android.art/lib64/libart.so (art::ThreadList::SuspendThreadByPeer(_jobject*, art::SuspendReason, bool*)+4016)
#06 pc 0x000000000060a90c /apex/com.android.art/lib64/libart.so (art::Thread_setNativeName(_JNIEnv*, _jobject*, _jstring*) (.__uniq.300150332875289415499171563183413458937)+492)
#07 pc 0x00000000003ff1c0 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+128) Happens on many Android 12 and 12L devices |
We'll provide either a workaround or will change the default behaviour in the next major version, thanks everyone for the reports! |
@qwwdfsad how to disable this debug mode in prodution build? |
@qwwdfsad is this fixed ? |
Any updates?
Note: Also, this is not the only backtrace. Lines
|
Going trough the link provided. It seems like you use a ProGuard rules to remove some debug modules. Is there a way to disable the debug mode without using ProGuard? |
Hello @qwwdfsad, #2234 (comment) is this issue fixed? |
is it solved |
这个问题解决了吗? |
No, it is not |
How to disable it in production build? |
Here's the instruction on how to enable or disable the debug mode: https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/topics/debugging.md#debug-mode |
Looking at the the art source it seems like this timeout when trying to set the thread name may be the culprit
https://android.googlesource.com/platform/art/+/master/runtime/thread_list.cc#970
It's not really clear to me whether this timeout would be triggered based on a specific state of the Thread or if it's just a race condition that is sometimes triggered.
It seems like the thread name changing is mostly cosmetic? I wonder if an option to disable or reduce thread name changes might be a quick solution--as much as I would hate giving that up for debug purposes :(
The text was updated successfully, but these errors were encountered: