You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sentry reports handled NRE as EXC_BAD_ACCESS signal #3776
Since exception is handled, there should be no reports in Sentry.
Actual Result
Sentry writes down the envelope and sends it in the next session. Example of the crashlog: crashlog.txt
In production, we also see examples of double reports - when unhandled managed NRE and native SIGSEGV are reported from the same device at the same time with very similar stacktraces. But it seems to be the result of the same issue.
I seems that this issue is related to the order of signal handlers and has the same root cause as dotnet/android#9055 (seems to have a fix on the Sentry side getsentry/sentry-native#1026). Also it might be related to this issue: #3678
Thanks for reporting this and thanks for tracking down related issues.
I seems that this issue is related to the order of signal handlers and has the same root cause as dotnet/android#9055 (seems to have a fix on the Sentry side getsentry/sentry-native#1026).
I suspect you're right. Support for alternative ordering of the signal handlers has already been added in sentry-native 0.7.13.
Would it be worth letting the cocoa SDK team know about this issue?
Possibly yes. How does the native sdk get initialised in an iOS application? Is it similar to Java where the Java SDK does that and we'd need to pass parameters via that SDK to configure how the native SDK gets initialized?
You'd need to read the code to work that out I think, and then explain to the cocoa team what changes you needed and why.
@philipphofmann are you the right person to tap on the shoulder about this?
We saw a problem recently when null reference exceptions are thrown on Android. Mischan gave a very comprehensive explanation of what was going on here.
It looks like the Coca SDK registers its own signal handlers. Possibly due to the order of registration, the Cocoa handlers are firing before the .NET handlers have a chance to handle the exception in .NET applications running on ios?
This is the fix that was made in Sentry Native... I expect something similar would have to be done to address in the Cocoa SDK (we could pass in a "Handler Strategy" enum/bool via the options when initialising the Cocoa SDK).
If getsentry/sentry-native#1027 fixes the problem, it seems like doing the same on Cocoa makes sense. @supervacuus, as you already implemented this in the native SDK, could you also add this to the Cocoa SDK? SentryCrash is a bit different from sentry-native, but it's still signal handlers.
If getsentry/sentry-native#1027 fixes the problem, it seems like doing the same on Cocoa makes sense. @supervacuus, as you already implemented this in the native SDK, could you also add this to the Cocoa SDK? SentryCrash is a bit different from sentry-native, but it's still signal handlers.
Sure, I can have a look. I could imagine this to be a bit more involved, since EXC_BAD_ACCESS is a mach exception and not a signal. AFAICR, the .net runtime uses both on mach-based OSes, but I can't remember any details. It might be necessary to adapt both, the SentryCrash signal- and mach exception-port handler. Even more importantly: figuring out how they interact (beyond their normal sequencing).
This is very concerning. We are relying on the crash rate to accurately determine the health of a release. If this is reporting false positives, this could be causing my team to currently be working on an unnecessary hotfix (when we could be fixing the handled exceptions in a future normal release)
We got a report today that suggests the "fix" we had prepared for a similar problem in Android did not work... so I don't think we can copy/paste the solution we used there. This needs some investigation. We'll try to fix the problem on Android first and then circle back to this iOS issue.
Apologies for the delay. We're a bit short handed on the .NET SDK at the moment.
It looks like there might be another path to fixing this. We already have some very similar code in the SDK to filter out such exceptions... just need to work out why this isn't triggering for the specific exception above:
Activity
jamescrosswell commentedon Nov 21, 2024
Hi @TimBurik,
Thanks for reporting this and thanks for tracking down related issues.
I suspect you're right. Support for alternative ordering of the signal handlers has already been added in sentry-native 0.7.13.
This PR is meant to address this for Android:
It's pending implementation of the same in the Java SDK.
It looks like we'd need to do something similar for iOS eh @bricefriha? Currently the fix is only applied in the Android/SentrySdk:
sentry-dotnet/src/Sentry/Platforms/Android/SentrySdk.cs
Line 91 in d9516bf
bricefriha commentedon Nov 22, 2024
Would it be worth letting the cocoa SDK team know about this issue?
jamescrosswell commentedon Nov 24, 2024
Possibly yes. How does the native sdk get initialised in an iOS application? Is it similar to Java where the Java SDK does that and we'd need to pass parameters via that SDK to configure how the native SDK gets initialized?
You'd need to read the code to work that out I think, and then explain to the cocoa team what changes you needed and why.
jamescrosswell commentedon Dec 3, 2024
@philipphofmann are you the right person to tap on the shoulder about this?
We saw a problem recently when null reference exceptions are thrown on Android. Mischan gave a very comprehensive explanation of what was going on here.
It looks like the Coca SDK registers its own signal handlers. Possibly due to the order of registration, the Cocoa handlers are firing before the .NET handlers have a chance to handle the exception in .NET applications running on ios?
This is the fix that was made in Sentry Native... I expect something similar would have to be done to address in the Cocoa SDK (we could pass in a "Handler Strategy" enum/bool via the options when initialising the Cocoa SDK).
philippsuess commentedon Dec 3, 2024
If getsentry/sentry-native#1027 fixes the problem, it seems like doing the same on Cocoa makes sense. @supervacuus, as you already implemented this in the native SDK, could you also add this to the Cocoa SDK? SentryCrash is a bit different from sentry-native, but it's still signal handlers.
supervacuus commentedon Dec 3, 2024
Sure, I can have a look. I could imagine this to be a bit more involved, since
EXC_BAD_ACCESSis a mach exception and not a signal. AFAICR, the .net runtime uses both on mach-based OSes, but I can't remember any details. It might be necessary to adapt both, theSentryCrashsignal- and mach exception-port handler. Even more importantly: figuring out how they interact (beyond their normal sequencing).MichaelLHerman commentedon Dec 19, 2024
This is very concerning. We are relying on the crash rate to accurately determine the health of a release. If this is reporting false positives, this could be causing my team to currently be working on an unnecessary hotfix (when we could be fixing the handled exceptions in a future normal release)
Any plans for a fix?
jamescrosswell commentedon Dec 19, 2024
We got a report today that suggests the "fix" we had prepared for a similar problem in Android did not work... so I don't think we can copy/paste the solution we used there. This needs some investigation. We'll try to fix the problem on Android first and then circle back to this iOS issue.
Apologies for the delay. We're a bit short handed on the .NET SDK at the moment.
jamescrosswell commentedon Jan 20, 2025
It looks like there might be another path to fixing this. We already have some very similar code in the SDK to filter out such exceptions... just need to work out why this isn't triggering for the specific exception above:
sentry-dotnet/src/Sentry/Platforms/Cocoa/SentrySdk.cs
Lines 153 to 177 in c20d162