sentry-java: Android 11 + targetSdkVersion 30 crashes Sentry on start
Platform:
- Android, targetSdkVersion 30
- Java
- Kotlin
- NDK
- React-Native
IDE:
- Android Studio
- IntelliJ
- Other
The version of sentry-android: 2.3.0(at least) - master
I have the following issue:
When I set the targetSdkVersion to 30 for my app and launch it on an Android 11 device (my Pixel 4XL), the app crashes immediately.
Steps to reproduce:
- Clone the
sentry-androidrepository - Change the example app to use
targetSdkVersion30.
diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts
index 5c29345..d299d1b 100644
--- a/sentry-samples/sentry-samples-android/build.gradle.kts
+++ b/sentry-samples/sentry-samples-android/build.gradle.kts
@@ -10,7 +10,7 @@ android {
defaultConfig {
applicationId = "io.sentry.samples.android"
minSdkVersion(Config.Android.minSdkVersionNdk)
- targetSdkVersion(Config.Android.targetSdkVersion)
+ targetSdkVersion(30)
versionCode = 2
versionName = "1.1.0"
- launch
sentry-samples-android
Actual result:
- Immediate crash
libc F Pointer tag for 0x79f0abdc30 was truncated.
Sentry D Processing dir. /data/user/0/io.sentry.samples.android/cache/sentry/sessions
libc F Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 15999 (samples.android), pid 15999 (samples.android)
Sentry D Processing 6 items from cache dir /data/user/0/io.sentry.samples.android/cache/sentry/sessions
D Processing file: /data/user/0/io.sentry.samples.android/cache/sentry/sessions/f146b6e6-91af-4a2f-a08c-014613f5e594.envelope
D Processing Envelope with 1 item(s)
D Captured Envelope is already cached
D Item 1 is being captured.
D Going to wait flush 1 item.
TetheringManager I registerTetheringEventCallback:io.sentry.samples.android
DEBUG F #00 pc 000000000004de4c /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 03452a4a418e14ff93948f26561eace6)
F getsentry/sentry-android#1 pc 000000000003bb34 /apex/com.android.runtime/lib64/bionic/libc.so (free+96) (BuildId: 03452a4a418e14ff93948f26561eace6)
F getsentry/sentry-android#2 pc 00000000000781a8 /data/app/~~gQctd6Q5azmrHpqfGRaWvQ==/io.sentry.samples.android-IaNp2cunocnQXp3s03mjng==/lib/arm64/libsentry.so (sentry_f
ree+36) (BuildId: a8252e0bb65f23db1c6420f10a30b2f3b1477309)
F getsentry/sentry-android#3 pc 0000000000085880 /data/app/~~gQctd6Q5azmrHpqfGRaWvQ==/io.sentry.samples.android-IaNp2cunocnQXp3s03mjng==/lib/arm64/libsentry.so (BuildId:
a8252e0bb65f23db1c6420f10a30b2f3b1477309)
F getsentry/sentry-android#4 pc 0000000000085710 /data/app/~~gQctd6Q5azmrHpqfGRaWvQ==/io.sentry.samples.android-IaNp2cunocnQXp3s03mjng==/lib/arm64/libsentry.so (sentry_v
alue_decref+92) (BuildId: a8252e0bb65f23db1c6420f10a30b2f3b1477309)
F getsentry/sentry-android#5 pc 000000000007f038 /data/app/~~gQctd6Q5azmrHpqfGRaWvQ==/io.sentry.samples.android-IaNp2cunocnQXp3s03mjng==/lib/arm64/libsentry.so (BuildId:
a8252e0bb65f23db1c6420f10a30b2f3b1477309)
Expected result:
- No crash
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 49 (28 by maintainers)
Commits related to this issue
- Update Sentry to latest to fix: https://github.com/getsentry/sentry-java/issues/904 — committed to die-tageszeitung/taz-neo by deleted user 3 years ago
https://github.com/getsentry/sentry-java/releases/tag/3.1.0
Same here. I have tested this thing on the Pixel 4a with OS 11 and it doesn’t work but it works on the Pixel 3a with OS 11. Something wrong on the Pixel 4* with OS 11…
not sure, it could be though, we’ve ordered a pixel 4 but it didn’t arrive yet.
meantime if somebody has a physical pixel 4, you could try this workaround too:
@marandaneto is this something related to https://source.android.com/devices/tech/debug/tagged-pointers ?
as a workaround, for now, disable the NDK integration.
https://docs.sentry.io/platforms/android/#configuration-options
eg:
this is just a debug log though, we run some code to see if the device is rooted or not and if not, we log it, this only appears if you run on debug mode, it’s not a bug. this issue is about a crash on startup using Pixel 4 and Android 11.
The issue has been fixed when using sentry-android v 4.1.0 Thanks of the support 👍
Confirming that both of @marandaneto’s mentioned workarounds seem to work on a physical Pixel 4 running Android 11.
or
So I just ran our android example through a debugger on a freshly patched Pixel 4.
https://github.com/getsentry/sentry-native/blob/425b803d53acc2d598633fd64ac969508487007e/src/sentry_value.c#L199
This
mallocgives me0xb400007bda776d90, after NaN-boxing, we end up with0x0000007bda776d90, and according to the documented linked above:Using
android:allowNativeHeapPointerTagging="false"as workaround works for me. Getting rid of the NaN-boxing insentry-nativewould be quite some work, but I suspect that we already ran into problems with it with a different native customer, though I’m not sure.you basically won’t get any Native crashes (NDK C/C++) reports on Sentry, if your App is just written in Java/Kotlin, it won’t be a big issue, thanks for confirming the workaround.
Having a similar issue on Pixel 4XL as well. Seeing this error log whenever I run my app:
Originally I suspected an error with Android’s new Wireless ADB feature that I was trying, but even plugging the phone in manually didn’t work.
I’m able to run on a Pixel 3a emulator with Android 11 just fine.
EDIT: I see the same thing in the logs when I run on a Pixel 3 XL, but it does not crash on startup. So maybe those logs are a red herring, but definitely something fishy going on with the Pixel 4 line.