Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## jpnurmi/fix/native-recover #2301 +/- ##
==============================================================
+ Coverage 75.64% 75.83% +0.19%
==============================================================
Files 105 105
Lines 30985 30989 +4
Branches 5784 5785 +1
==============================================================
+ Hits 23439 23501 +62
+ Misses 6115 6057 -58
Partials 1431 1431 🚀 New features to boost your workflow:
|
jpnurmi
force-pushed
the
jpnurmi/fix/native-android-21
branch
from
November 11, 2026 17:49
c068b33 to
a22c3b7
Compare
mujacica
approved these changes
Nov 12, 2026
JoshuaMoelans
approved these changes
Nov 12, 2026
jpnurmi
added a commit
to getsentry/sentry-java
that referenced
this pull request
Nov 16, 2026
DO NOT MERGE (revert after releasing getsentry/sentry-native#2301) `SentryNdk.createCrashShm(String)` is not in a sentry-native release yet. Build `sentry-native-ndk-outproc` from the sentry-native branch and publish it to Maven Local under a version that Maven Central does not have, so that Gradle resolves the local build.
9 tasks
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7f9923a. Configure here.
Collaborator
Author
|
Applied Roman's suggestions from getsentry/sentry-java#6614 (comment) |
`memfd_create` needs Linux 3.17, so creating the crash service's shared memory failed on older kernels, and the SDK disabled native crash reporting. When `memfd_create` fails, create an unlinked file in the database directory instead. Preallocate it with `posix_fallocate()`, because a sparse file raises `SIGBUS` on write when the disk is full. Java passes the directory to the new `SentryNdk.createCrashShm(String)` overload, and `createCrashShm()` keeps using memfd only.
The overload without a database directory has no file fallback, so it needs a kernel with memfd rather than a specific API level.
Match the Android API levels and NDK versions in `ci.yml`. The crash IPC now works without memfd, so drop the fixture's API 30 `minSdk` and the tests' API 30 skips.
The API 21 and 26 e2e jobs need the sentry-java side of running the crash service below API 30.
API 31 tombstones leave dex frames unnamed, so the merged event has no Java method names. Check them only on later API levels. The fixture crashed 1 s after setting the scope, but sentry-java syncs the scope to native on its single-threaded executor, behind the startup work of the tombstone integration. Now that the crash service starts without waiting, that work can still run when the crash fires, and the event misses the `test.id` tag. Queue the crash on the executor, so that it follows the scope sync. Print logcat when an Android e2e test fails.
`has_native` was false below API 23, so the API 21 e2e job skipped all Android tests and never exercised the file fallback for crash IPC. API 21 is the minimum, so drop the Android clause.
A non-UTF-8 byte in `adb logcat` output raised `UnicodeDecodeError` in the fixture teardown and lost the logcat dump of a failed test.
The API 23 skip blamed `process_vm_readv`, but below API 23 `sentry__process_vm_readv()` calls the raw syscall.
The e2e tests do not use Google Play services. Use the smaller AOSP images, like the regular Android CI jobs.
Below API 29, the app receives the crash service connection on its main thread. A native crash on the main thread before the daemon attached froze the app for 10 s, waiting for a daemon that couldn't attach, and then chained. Don't notify it in that case, so the crash chains at once. A crash on another thread still waits, since the main thread is free to attach the daemon.
A crash on the main thread checks whether the crash service attached without the writer lock. A concurrent send could read the ready signal between the crash handler's poll and read, and the handler then blocked on the drained pipe. Poll without reading, so that every caller sees the signal. A reattach replaces the pipe, which drops the old signal.
The e2e fixture crashed 1 s after `SentryAndroid.init`, so no test covered a crash on the main thread before the crash service connects. Add an early variant that crashes as soon as the scope is synced. It runs on API 29 and later, where the service connects on a binder thread while the crash handler waits.
Crash synchronously right after init, so that below API 29 the main looper cannot connect the crash service first, and relaunch the app to send the crash.
jpnurmi
force-pushed
the
jpnurmi/fix/native-android-21
branch
from
November 20, 2026 14:12
0c9e82f to
cb7af51
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

💡 Before, Native on Android required API 30+. Now, it works with the same API 21+ as Inproc.
The crash service's shared memory used
memfd_create, which needs Linux 3.17+. Devices that launched before API 26 may run older kernels, where native SDK init failed and native crash reporting was disabled.SentryNdk.createCrashShm(String)now falls back to an unlinked file in the database directory, preallocated withposix_fallocate()so that a full disk fails at init instead of raisingSIGBUSon a later write.createCrashShm()keeps using memfd only.Required for, and to be merged after agreeing on: