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 doesn't catch iOS crash on app startup #2434

Closed
5 tasks done
Off2Race opened this issue Aug 23, 2022 · 4 comments
Closed
5 tasks done

Sentry doesn't catch iOS crash on app startup #2434

Off2Race opened this issue Aug 23, 2022 · 4 comments

Comments

@Off2Race
Copy link

OS:

  • MacOS

Platform:

  • iOS

SDK:

  • @sentry/react-native (>= 1.0.0)

SDK version: 4.2.3

react-native version: 0.67.4

Are you using Expo?

  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)

Configuration:
See the issue description below.


I have following issue:

In general, Sentry for React Native works great in our app. We've just started using the SDK but the tool has already helped us to catch several issues in our Javascript that only occurred "randomly" in Production for end users. We're very happy with Sentry.

The issue we have is trying to catch a native crash that occurs on startup. The issue is very hard to reproduce. We've never been able to make it happen in development, even when running in release mode. But periodically the app will crash for an end user on startup, particularly when the device is in an "imperfect" network state. By "imperfect," I mean that the network isn't fully online or offline. It's somewhere in the middle. If the network is fully good or bad, our app starts without issue. But if the user is on Wi-Fi network that's good but the internet is bad or a 5G connection with 4 bars but is struggling to connect to the internet, we get the crash.

I've read the documentation which suggests doing a manual startup of the SDK in didFinishLaunchingWithOptions, so we added the following:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
		options.dsn = @"https://xxxxxxx.ingest.sentry.io/xxxxxxx";
	}];

This early initialization seems to work fine. If we add code immediately after the call above that deliberately crashes the app, Sentry will catch it perfectly. But it won't catch the startup crash that occurs for our users in Production. My only conclusion is that that crash happens even earlier in the startup cycle. Or maybe we're doing something not quite right with the configuration.

Any thoughts on how we can configure Sentry to actually catch this crash? Is there somewhere "earlier" that we can start the Sentry SDK that might help?

Any other suggestions? Either with Sentry or ways that we can troubleshoot this frustrating issue.

Thanks!

@marandaneto
Copy link
Contributor

I believe this could be because the iOS SDK sends crashes on a background thread and maybe there's not enough time in a few corner cases even if blocking the call, @brustolin @philipphofmann IIRC there was an issue related to that on iOS (I could not find it), can we link it?

@marandaneto
Copy link
Contributor

Likely getsentry/sentry-cocoa#316

@bruno-garcia
Copy link
Member

We're tracking this here:

@marandaneto
Copy link
Contributor

#2506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants