feat: native signal handler strategy on Android#4676
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4676 +/- ##
==========================================
+ Coverage 73.85% 76.59% +2.73%
==========================================
Files 483 446 -37
Lines 17578 16242 -1336
Branches 3464 3234 -230
==========================================
- Hits 12982 12440 -542
+ Misses 3742 3051 -691
+ Partials 854 751 -103 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@jamescrosswell This is marked as a draft because it's still waiting for dependencies, but we could already kick off the review process if you have time. :) Do you have a preferred approach for exposing this as an opt-in API? The current proposal mirrors the sentry-native enum. #if ANDROID
options.Native.SignalHandlerStrategy = Sentry.Android.SignalHandlerStrategy.ChainAtStart;
#endifWith only two values, a simple boolean flag could also work for the time being, but I'm unsure if potential Android Tombstone support could change things in the future. |
af57caa to
4486918
Compare
4486918 to
7a489eb
Compare
7a489eb to
543b3e3
Compare
|
Update: I'll get back to this after #4750 to make sure this works with .NET 10 |
…-handler-strategy
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Features ✨
Dependencies ⬆️
🤖 This preview updates automatically when you update the PR. |
|
While the signal handler strategy fixes the redundant |
|
.NET 10 on ARM64 and .NET 9.0 on both ARM64 and X86_64 behave as desired when sentry-native calls the runtime's signal handler. It returns to sentry-native which then captures the crash. .NET 10 on X86_64, however, crashes trying to lock a destroyed mutex? No crash captured. .NET 9.0 (Android ARM64 & X86_64) 👍NET 10.0 (Android ARM64) 👍NET 10.0 (Android X86_64) 👎 |
|
Claude confidently claims the issue was fixed by: The fix was backported to Investigation: .NET 10 x86_64 native crash test failureTraced the root cause via What happensWhen sentry-native defers to Mono's signal handler (
The assertion triggers FixAlready merged upstream:
|
b64b284 to
bda8f1b
Compare
|
SDK 10.0.103 ships with runtime 10.0.3, which was built 12 days before the fix was merged. The fix is in the
Confirmed with strace — the crash sequence is identical to before: |
|
I confirmed with a locally built I used the 10.0.3 baseline of |
Nice! So once 10.0.30 is released we could put together a fix. Would our SDK users also need to be building with 10.0.3 or is it sufficient for us to be building the Sentry SDK for .NET with it? |
|
Applying the fix when building Sentry alone is not sufficient. The fix must be present in the .NET runtime / Mono DLL that is packaged inside the application APK. Unfortunately, the fix was not included in version 10.0.3, which was released a few days ago. We'll have to wait for 10.0.4, the next monthly servicing update. |
Opt-in, Android-only solution for:
According to our newly introduced Android integration tests, getsentry/sentry-native#1392 works on
android-arm64andandroid-x64in bothReleaseandDebugconfigurations, but we'd like to validate the fix further in real-world conditions. To that end, we're making it opt-in initially so customers can try it on more devices, platforms, and configurations before considering it as the new default.Note
Depends on: