Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry reports handled NRE as EXC_BAD_ACCESS signal #3776

Open
TimBurik opened this issue Nov 21, 2024 · 2 comments
Open

Sentry reports handled NRE as EXC_BAD_ACCESS signal #3776

TimBurik opened this issue Nov 21, 2024 · 2 comments

Comments

@TimBurik
Copy link

Package

Sentry

.NET Flavor

.NET

.NET Version

9.0.100

OS

iOS

SDK Version

4.13.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

  1. Create empty dotnet iOS project, add Sentry nuget package;
  2. In FinishedLaunching(), initialize SentrySdk:
SentrySdk.Init(options =>
 {
    options.Dsn = "...";
    options.Debug = true;
    options.SampleRate = 1.0f;
});
  1. After Sentry is initialized, execute a code like this:
try
{
    object o = null;
    Console.WriteLine(o.ToString()); //throws NullReferenceException
}
catch (Exception e)
{
    Console.WriteLine(e);
}

Expected Result

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

@jamescrosswell
Copy link
Collaborator

Hi @TimBurik,

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.

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:

o.SetNativeHandlerStrategy(JavaSdk.Android.Core.NdkHandlerStrategy.SentryHandlerStrategyChainAtStart);

@bricefriha
Copy link
Collaborator

Currently the fix is only applied in the Android/SentrySdk

Would it be worth letting the cocoa SDK team know about this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: No status
Development

No branches or pull requests

3 participants