fix: prevent redundant native exceptions on Android/Mono#4676
fix: prevent redundant native exceptions on Android/Mono#4676jamescrosswell merged 11 commits intomainfrom
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4676 +/- ##
==========================================
- Coverage 74.12% 74.00% -0.13%
==========================================
Files 499 499
Lines 18067 18067
Branches 3520 3520
==========================================
- Hits 13392 13370 -22
- Misses 3813 3838 +25
+ Partials 862 859 -3 ☔ 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
7a489eb to
543b3e3
Compare
|
Update: I'll get back to this after #4750 to make sure this works with .NET 10 |
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
|
While the signal handler strategy fixes the redundant |
This comment was marked as outdated.
This comment was marked as outdated.
|
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. |
862423a to
47248ba
Compare
|
Looks like 10.0.4 is finally out and even 10.0.5, which we have a PR to bump to here: That PR needs some debugging - @jpnurmi would you have the bandwidth to look at it or should @Flash0ver or I pick it up? |
|
Another issue has come up. 😓 While testing against 10.0.4, I discovered that the refactored inproc backend introduced in sentry-native 0.13 broke the To prevent similar regressions going forward, we're also adding a .NET Android integration test to the Native SDK: |
Hm... what's your gut tell you about the robustness of the solution we're putting in place here? Is it something that's likely to work for long periods without us needing to pay attention to it or is it possibly fragile and going to be a time sink? I mean, pretty much everything about MAUI seems fragile to some extent... is this going to be worse though? |
|
As AI would put it, "You're absolutely right to question that!" Chaining signal handlers as we do with the "chain-at-start" strategy is not an officially supported use case and could potentially break in any future version of .NET or Android. Furthermore, there's an endless combination of versions and targets/devices/emulators/architectures to cover, and we have quite big gaps in testing as we currently can't even test on ARM64 (#4660). If we still want to release this, it's best to start with an opt-in to gather feedback. |
🤣
That sounds like a good approach... maybe we leave it opt in for a decent amount of time to see if it can survive major version bumps in the various different moving parts. |
47248ba to
448380a
Compare
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [Sentry.Maui](https://sentry.io/) ([source](https://github.com/getsentry/sentry-dotnet)) | nuget | minor | `6.3.2` -> `6.4.0` | --- ### Release Notes <details> <summary>getsentry/sentry-dotnet (Sentry.Maui)</summary> ### [`v6.4.0`](https://github.com/getsentry/sentry-dotnet/blob/HEAD/CHANGELOG.md#640) [Compare Source](getsentry/sentry-dotnet@6.3.2...6.4.0) ##### Features ✨ - feat: Add network details for session replay on iOS by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​4891](getsentry/sentry-dotnet#4891) - feat: Add option to exclude certain HTTP statuses from tracing by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5034](getsentry/sentry-dotnet#5034) ##### Fixes 🐛 - fix: memory leak when profiling is enabled by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5133](getsentry/sentry-dotnet#5133) - fix: prevent redundant native exceptions on iOS by [@​jpnurmi](https://github.com/jpnurmi) in [#​5126](getsentry/sentry-dotnet#5126) - fix: prevent redundant native exceptions on Android/Mono by [@​jpnurmi](https://github.com/jpnurmi) in [#​4676](getsentry/sentry-dotnet#4676) - Note: opt in by setting `options.Native.ExperimentalOptions.SignalHandlerStrategy` to `Sentry.Android.SignalHandlerStrategy.ChainAtStart` ##### Dependencies ⬆️ ##### Deps - chore(deps): update Cocoa SDK to v9.10.0 by [@​github-actions](https://github.com/github-actions) in [#​5132](getsentry/sentry-dotnet#5132) - chore(deps): update Cocoa SDK to v9.9.0 by [@​github-actions](https://github.com/github-actions) in [#​5115](getsentry/sentry-dotnet#5115) - chore(deps): update Java SDK to v8.38.0 by [@​github-actions](https://github.com/github-actions) in [#​5124](getsentry/sentry-dotnet#5124) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or PR is renamed to start with "rebase!". 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
Updated [Sentry.AspNetCore](https://github.com/getsentry/sentry-dotnet) from 6.3.2 to 6.4.0. <details> <summary>Release notes</summary> _Sourced from [Sentry.AspNetCore's releases](https://github.com/getsentry/sentry-dotnet/releases)._ ## 6.4.0 ### Features ✨ - feat: Add network details for session replay on iOS by @jamescrosswell in [#4891](getsentry/sentry-dotnet#4891) - feat: Add option to exclude certain HTTP statuses from tracing by @jamescrosswell in [#5034](getsentry/sentry-dotnet#5034) ### Fixes 🐛 - fix: memory leak when profiling is enabled by @jamescrosswell in [#5133](getsentry/sentry-dotnet#5133) - fix: prevent redundant native exceptions on iOS by @jpnurmi in [#5126](getsentry/sentry-dotnet#5126) - fix: prevent redundant native exceptions on Android/Mono by @jpnurmi in [#4676](getsentry/sentry-dotnet#4676) - Note: opt in by setting `options.Native.ExperimentalOptions.SignalHandlerStrategy` to `Sentry.Android.SignalHandlerStrategy.ChainAtStart` ### Dependencies ⬆️ #### Deps - chore(deps): update Cocoa SDK to v9.10.0 by @github-actions in [#5132](getsentry/sentry-dotnet#5132) - chore(deps): update Cocoa SDK to v9.9.0 by @github-actions in [#5115](getsentry/sentry-dotnet#5115) - chore(deps): update Java SDK to v8.38.0 by @github-actions in [#5124](getsentry/sentry-dotnet#5124) Commits viewable in [compare view](getsentry/sentry-dotnet@6.3.2...6.4.0). </details> Updated [Sentry.Extensions.Logging](https://github.com/getsentry/sentry-dotnet) from 6.3.2 to 6.4.0. <details> <summary>Release notes</summary> _Sourced from [Sentry.Extensions.Logging's releases](https://github.com/getsentry/sentry-dotnet/releases)._ ## 6.4.0 ### Features ✨ - feat: Add network details for session replay on iOS by @jamescrosswell in [#4891](getsentry/sentry-dotnet#4891) - feat: Add option to exclude certain HTTP statuses from tracing by @jamescrosswell in [#5034](getsentry/sentry-dotnet#5034) ### Fixes 🐛 - fix: memory leak when profiling is enabled by @jamescrosswell in [#5133](getsentry/sentry-dotnet#5133) - fix: prevent redundant native exceptions on iOS by @jpnurmi in [#5126](getsentry/sentry-dotnet#5126) - fix: prevent redundant native exceptions on Android/Mono by @jpnurmi in [#4676](getsentry/sentry-dotnet#4676) - Note: opt in by setting `options.Native.ExperimentalOptions.SignalHandlerStrategy` to `Sentry.Android.SignalHandlerStrategy.ChainAtStart` ### Dependencies ⬆️ #### Deps - chore(deps): update Cocoa SDK to v9.10.0 by @github-actions in [#5132](getsentry/sentry-dotnet#5132) - chore(deps): update Cocoa SDK to v9.9.0 by @github-actions in [#5115](getsentry/sentry-dotnet#5115) - chore(deps): update Java SDK to v8.38.0 by @github-actions in [#5124](getsentry/sentry-dotnet#5124) Commits viewable in [compare view](getsentry/sentry-dotnet@6.3.2...6.4.0). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: James Gunn <james@gunn.io>
Experimental opt-in Android-only solution for:
According to our newly introduced Android integration tests,
CHAIN_AT_STARTworks onandroid-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.Changelog Entry
options.Native.ExperimentalOptions.SignalHandlerStrategytoSentry.Android.SignalHandlerStrategy.ChainAtStart