Android Crash: SIGSEGV 0x0000000000000000 - libc.so | Crashed: null pointer dereference
🛑 Blocked by https://github.com/getsentry/sentry-java/issues/3653
Description
Crashed: null pointer dereference #1
SIGSEGV 0x0000000000000000
libc.so
(Missing BuildId d1a98b526f2f94260a53c3055979a4f6)
We've observed that this crash spiked on 7th Sep. We've seen that [sentry-java](https://github.com/getsentry/sentry-java/releases/tag/7.0.0-rc.2 here) provided the fix for these issues. but we're still seeing this error with the sentry SDK versions mentioned below.
React Native Version: 0.71.13 with Hermes enabled
"@sentry/react": "^7.75.0",
"@sentry/react-native": "^5.22.3",
"@sentry/tracing": "^7.75.0",
"@sentry/types": "^7.75.0",
"@sentry/utils": "^7.75.0",
After investigating the statistics in Firebase Crashlytics, I found
- It is happening mostly on Android 12+ devices.
- Could not relate this to the memory shortage, devices had free memory (Adding screenshots for the same).
Steps to reproduce
Not able to reproduce this issue as this has been occurring randomly on Android devices.
React Native Version
0.71.13
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: macOS 14.6.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 37.20 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
Yarn: Not Found
npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
Watchman: 2024.08.26.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.13.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
Android SDK:
API Levels: 23, 28, 29, 30, 31, 33, 33, 34
Build Tools: 30.0.2, 30.0.3, 33.0.0, 33.0.2, 34.0.0
System Images: android-30 | Google APIs Intel x86 Atom, android-31 | Google APIs Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode: 15.2/15C500b - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.13 => 0.71.13
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Stacktrace or Logs
null pointer dereference: SIGSEGV 0x0000000000000000
#00 pc 0x96850 libc.so (BuildId: d1a98b526f2f94260a53c3055979a4f6)
#01 pc 0x5b510c libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#02 pc 0x5b487c libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#03 pc 0x5b6814 libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#04 pc 0x54eeb0 libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#05 pc 0x5b6148 libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#06 pc 0x933e24 libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#07 pc 0x93023c libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#08 pc 0x160fc libbase.so (BuildId: 42d41ca7c77853791d096606e7186547)
#09 pc 0x156d0 libbase.so (BuildId: 42d41ca7c77853791d096606e7186547)
#10 pc 0x5b74ec libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#11 pc 0x30b2b4 libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#12 pc 0x63eec8 libart.so (BuildId: 7300f6c36a74cc43266451736b120528)
#13 pc 0x104fc4 libc.so (BuildId: d1a98b526f2f94260a53c3055979a4f6)
#14 pc 0x9e764 libc.so (BuildId: d1a98b526f2f94260a53c3055979a4f6)
Reproducer
NA
Screenshots and Videos
Hi @vinayak-bm-ai,
thank you for the message.
Did the spike happen without any changes on your side, no new version...?
Linking the possibly related issue from sentry-java
- https://github.com/getsentry/sentry-java/issues/2955
@markushi I don't have context of the original Android issue, could you take a look?
Yes @krystofwoldrich , we haven’t made any changes to the codebase, no new version
@vinayak-bm-ai thanks for sharing all the details! I took a look at the attached stacktrace, and there's no sentry symbol involved in the crashing thread. Why do you think this is caused by sentry?
On top of that could you share your sentry config options with us?
Hey @markushi We're unable to reproduce this crash as it suddenly spiked out of nowhere. After researching, we found that sentry-java had a similar issue before, and since sentry-android uses it, the fix for this issue has been added to sentry-react-native. (https://github.com/getsentry/sentry-java/releases/tag/7.0.0-rc.2 here) can you also check this once? Also, the crash count is increasing day by day.
Sentry.init({
dsn: dns,
environment: env,
debug: false,
integrations: [
new Sentry.ReactNativeTracing({
enableUserInteractionTracing: true,
routingInstrumentation,
}),
Sentry.metrics.metricsAggregatorIntegration(),
],
tracesSampler: (samplingContext) => {
const transactionOp = samplingContext.transactionContext.op;
if (transactionOp === 'navigation') {
return 0.1;
}
return 1;
},
beforeBreadcrumb: (breadcrumb, hint) => {
if (
breadcrumb.category === 'console' ||
(breadcrumb.category === 'xhr' &&
breadcrumb?.data?.url?.includes('http://localhost:8081/')) ||
(breadcrumb?.data?.status_code >= 200 &&
breadcrumb?.data?.status_code < 300)
) {
return null;
}
return breadcrumb;
},
_experiments: {
profilesSampleRate: 1.0,
},
});
@vinayak-bm-ai Thank you for the init options, we will investigate it.
Any new updates ? app keep crashing in production now
@vinayak-bm-ai thanks for sharing all the details. Unfortunately I still don't see how this issue is related to sentry. Yes, there was a similar issue in combination with sentry in the past, but
-
libsentry.sowas part of the stacktrace (which I don't see here) - it was fixed nearly a year ago
The root cause of the issue suddenly appearing out of nowhere could be the same though: a Google Play System update. So maybe it's worth checking which versions are installed on the affected devices.
Having said that, we've seen Profiling (the Android System Profiler used by the Android SDK) causing native crashes, if possible you could try to release a version with profilesSampleRate: 0.0 to see if it has any positive effect.
We managed to temporary fix the issue removing profilesSampleRate as @markushi suggests.
We managed to temporary fix the issue removing profilesSampleRate as @markushi suggests.
Glad to hear this helped!
It's worth mentioning that we've opened several bug reports and PRs to AOSP, to get this fixed in the long run, see this issue for more details.
If you can get hold of a detailed crash report, a tombstone or similar please share them with us, as this helps us tremendously!
Just to double check: @krystofwoldrich there's no known issue around native crashes due to RN profiling, right?
Quick update: This issue is actually a duplicate of https://github.com/getsentry/sentry-java/issues/3653 The good news: The underlying Android issue was fixed already. The bad news: Unfortunately we don't know when/how Google will roll it out.
In the meantime we recommend disabling the Android native platform profiling, a feature we shipped in version 5.33.0 of the Sentry RN SDK:
import * as Sentry from '@sentry/react-native';
Sentry.init({
integrations: [
Sentry.hermesProfilingIntegration({ platformProfilers: false }),
],
});
We're keeping this issue open and will share any updates about the rollout.
@markushi Just to double check: @krystofwoldrich there's no known issue around native crashes due to RN profiling, right?
Correct, there are no known crashes due to RN (Hermes) profiling.
Closing this as it has been fixed by Google. Follow https://issuetracker.google.com/issues/361129298 for updates on rollout status. Latest information is that the fix has been part of the Sept 2024 mainline updates.