Skip to content

feat(android): Add opt-in out-of-process native crash backend - #7152

Draft
jpnurmi wants to merge 2 commits into
mainfrom
jpnurmi/feat/native-backend
Draft

jpnurmi wants to merge 2 commits into
mainfrom
jpnurmi/feat/native-backend

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds an opt-in for sentry-native 1.0's out-of-process crash backend on Android. See https://blog.sentry.io/sentry-native-sdk-1-0/.

Setting SENTRY_NATIVE_BACKEND=native as a Gradle property or an environment variable replaces the inproc sentry-native-ndk with sentry-android-ndk-outproc, whose crash service sends native crashes at crash time instead of on the next launch.

CI builds an extra production sample APK with the switch and runs a Maestro flow that crashes in native code without relaunching the app. The mocked Sentry server now gunzips only gzip-encoded requests, because the crash service sends envelopes uncompressed.

💡 Motivation and Context

With the inproc backend, a native crash reaches Sentry only if the app is launched again.

💚 How did you test it?

yarn test-android-native and manual native crashes in the sample on a Pixel 8 Pro: https://sentry-sdks.sentry.io/issues/7874367971/?project=5428561

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

Setting `SENTRY_NATIVE_BACKEND=native` as a Gradle property or an
environment variable replaces the inproc `sentry-native-ndk` with
`sentry-android-ndk-outproc`. Its crash service sends native crashes
at crash time instead of on the next launch.

CI builds an extra production sample APK with the switch and runs a
Maestro flow that crashes in native code without relaunching the app,
so only the crash service can send the `SIGSEGV` event. The mocked
Sentry server now gunzips only gzip-encoded requests, because the
crash daemon sends envelopes uncompressed.
@github-actions

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(android): Add opt-in out-of-process native crash backend by jpnurmi in #7152
  • ci: Add the PR classifiers workflow by christophaigner with sentry-junior in #7142
  • chore(deps): bump getsentry/github-workflows/danger from bce11fe6eaa86dbb9d360ab45a96e659828877f0 to edc87d6f133ac6204e22dee5123167a5eff3ed79 by dependabot in #7137
  • chore(deps): bump ruby/setup-ruby from 1.342.0 to 1.345.0 by dependabot in #7136
  • chore(deps): bump getsentry/craft from 3.13.0 to 3.14.1 by dependabot in #7135
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 3.13.0 to 3.14.1 by dependabot in #7134
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #7133
  • chore(deps): update Sentry Android Gradle Plugin to v6.28.0 by github-actions in #7129
  • feat(tracing): Report long tasks as ui.long-task spans in transactions by alwx in #7110
  • chore(deps): update Maestro to v2.13.0 by github-actions in #7126
  • chore(tooling): Make the verify-pr gate stop at the first no by antonis and claude with sentry-junior in #7125
  • chore(tooling): Add review checks and a gate-only mode to verify-pr by antonis and claude in #7121
  • chore(tooling): Fold the open-PR run findings into verify-pr by antonis and claude in #7115

🤖 This preview updates automatically when you update the PR.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 89ff7fe.

Main concerns: dependencies customers inherit, public contract, data sent to Sentry.

Rules that block low also fired:

  • R5: dependencies or bundled SDK versions changed: packages/core/android/build.gradle, samples/react-native/package.json
  • R6: build or release configuration changed: .github/workflows/sample-application.yml, packages/core/android/build.gradle

This label is a hint for reviewers, not an approval.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 89ff7fe

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 30, 2026
jpnurmi added a commit to getsentry/sentry-native that referenced this pull request Dec 1, 2026
On arm64 with pointer authentication, frame records hold signed
return addresses. The handler's capture recorded them as junk, and
the daemon's own walk would too, because `SENTRY__STRIP_PAC` only
stripped on macOS.

Replace it with a shared `sentry__strip_pac()`, which keeps the macOS
mask and uses `xpaclri` on Linux and Android, a NOP on CPUs without
PAC. A fixed mask does not fit there because the PAC bits start at
the virtual address size, such as bit 39 on Android.

Like `strip_pac()` in libunwindstack-ndk from
getsentry/libunwindstack-ndk#12 and `StripPACBits()` in crashpad from
getsentry/crashpad#118, it binds the address to x30 with a register
variable for `xpaclri`.

Ref: getsentry/sentry-react-native#7152
jpnurmi added a commit to getsentry/sentry-native that referenced this pull request Dec 1, 2026
On arm64 with pointer authentication, frame records hold signed
return addresses. The handler's capture recorded them as junk, and
the daemon's own walk would too, because `SENTRY__STRIP_PAC` only
stripped on macOS.

Replace it with a shared `sentry__strip_pac()`, which keeps the macOS
mask and uses `xpaclri` on Linux and Android, a NOP on CPUs without
PAC. A fixed mask does not fit there because the PAC bits start at
the virtual address size, such as bit 39 on Android.

Like `strip_pac()` in libunwindstack-ndk from
getsentry/libunwindstack-ndk#12 and `StripPACBits()` in crashpad from
getsentry/crashpad#118, it binds the address to x30 with a register
variable for `xpaclri`.

Ref: getsentry/sentry-react-native#7152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant