Skip to content

feat(samples): Make Native Crash button fault inside app native code#5773

Merged
runningcode merged 1 commit into
mainfrom
no/native-sample-segfault-crash
Jul 17, 2026
Merged

feat(samples): Make Native Crash button fault inside app native code#5773
runningcode merged 1 commit into
mainfrom
no/native-sample-segfault-crash

Conversation

@runningcode

@runningcode runningcode commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

📜 Description

Changes the Android sample's Native Crash button so it faults inside app native code — a null-pointer dereference in a named function (trigger_null_deref in native-sample.cpp) — instead of raise(SIGSEGV).

💡 Motivation and Context

raise(SIGSEGV) faults inside libc, and for a crash originated from a JNI call the unwind is either the managed ART/OAT stack or a degenerate native stack — so it does not exercise symbolication of the app's own native code. A genuine null-deref inside a named function faults with a valid PC inside libnative-sample.so, so the crashing frame resolves to a real symbol + source line. This makes it easy to verify native symbol upload / symbolication end-to-end from the sample.

Came out of the JAVA-645 investigation, where raise(SIGSEGV) turned out to be a poor vehicle for testing native symbolication.

💚 How did you test it?

During the JAVA-645 investigation, an equivalent null-deref (crash()trigger_null_deref()) was run on a Pixel 10 (Android 17), release build with SAGP (uploadNativeSymbols=true), and the crashing frame symbolicated to trigger_null_deref in native-sample.cpp with the source line shown.

This exact change compiles (assembleRelease); I did not re-flash it, so the reported line reflects the committed layout — *ptr = 42; is native-sample.cpp:15.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

None — sample-only change.

#skip-changelog

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 001d5b8

@sentry

sentry Bot commented Jul 16, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.49.0 (1) release

⚙️ sentry-android Build Distribution Settings

The Native Crash button called raise(SIGSEGV), which faults inside libc and, for a JNI-originated crash, does not exercise symbolication of the app's own native code. Point it at a null-deref inside a named function (trigger_null_deref) instead, so the crashing frame resolves to a real symbol + source line and native symbolication can be verified from the sample.

Ref JAVA-645

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmE8hdaj9H9K61opK2PZ6U
@runningcode
runningcode force-pushed the no/native-sample-segfault-crash branch from 5703b7b to 001d5b8 Compare July 16, 2026 13:52
@runningcode runningcode changed the title feat(samples): Add native segfault (null-deref) crash button feat(samples): Make Native Crash button fault inside app native code Jul 16, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 001d5b8. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 329.32 ms 381.88 ms 52.56 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b193867 319.59 ms 403.09 ms 83.50 ms
2124a46 319.19 ms 415.04 ms 95.85 ms
a5ab36f 316.83 ms 394.54 ms 77.71 ms
dba088c 320.59 ms 361.29 ms 40.70 ms
4e3e79d 328.10 ms 395.64 ms 67.54 ms
abfcc92 309.54 ms 380.32 ms 70.78 ms
539ca63 313.51 ms 355.43 ms 41.92 ms
3d205d0 352.15 ms 432.53 ms 80.38 ms
bb0ff41 312.86 ms 363.78 ms 50.92 ms
2195398 319.02 ms 342.38 ms 23.36 ms

App size

Revision Plain With Sentry Diff
b193867 1.58 MiB 2.19 MiB 620.00 KiB
2124a46 1.58 MiB 2.12 MiB 551.51 KiB
a5ab36f 1.58 MiB 2.12 MiB 555.26 KiB
dba088c 1.58 MiB 2.13 MiB 558.99 KiB
4e3e79d 0 B 0 B 0 B
abfcc92 1.58 MiB 2.13 MiB 557.31 KiB
539ca63 1.58 MiB 2.12 MiB 551.41 KiB
3d205d0 1.58 MiB 2.10 MiB 532.97 KiB
bb0ff41 0 B 0 B 0 B
2195398 0 B 0 B 0 B

@markushi markushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We intentionally are not doing this, as it caused endless crash loops in release builds, see #4930

@runningcode
runningcode enabled auto-merge (squash) July 17, 2026 10:45
@runningcode
runningcode disabled auto-merge July 17, 2026 10:45
@markushi
markushi self-requested a review July 17, 2026 14:09

Copy link
Copy Markdown
Contributor Author

Thanks for checking this!

@runningcode
runningcode merged commit 0ee65e9 into main Jul 17, 2026
35 checks passed
@runningcode
runningcode deleted the no/native-sample-segfault-crash branch July 17, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants