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.init locking up UI thread on launch #3820

Closed
5 of 11 tasks
desmondmc opened this issue May 16, 2024 · 6 comments
Closed
5 of 11 tasks

Sentry.init locking up UI thread on launch #3820

desmondmc opened this issue May 16, 2024 · 6 comments

Comments

@desmondmc
Copy link

desmondmc commented May 16, 2024

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

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

SDK version: 5.22.2

react-native version: 0.72.6

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

N/A

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://[email protected]/...'
  attachScreenshot: true, // Note removing this doesn't fix the issue.
});

I have the following issue:

When launching the app while in airplane mode, calling Sentry.init seems to lock up the UI thread. It doesn't happen every time. On my iPhone 14 Pro it's happening ~3-10 launches.

The issue started occurring when we updated from @sentry/react-native 5.17.0 to 5.22.2. We know it's definitely Sentry.init is causing the issue because when we remove it, the problem goes away.

We weren't able to reproduce the issue on debug versions of the app. We were only able to reproduce the issue on release versions.

Steps to reproduce:

  • Download and open our production iOS app
  • Put your phone in Airplane mode
  • Force close the app
  • Reopen it
  • Repeat until you see the app gets stuck on the Splash Screen.

Actual result:

The app locks up

Expected result:

The app launches as usual.

@krystofwoldrich
Copy link
Member

Hi @desmondmc,
thank you for the details,

would you be also able to reproduce it with a sample app for which you could share a source code?

Does it only happen on real device or also with Production build and Airplane/Offline mode on simulator?

@desmondmc
Copy link
Author

Thanks for the quick response @krystofwoldrich

would you be also able to reproduce it with a sample app for which you could share a source code?

I'll get back to you on this one, hopefully early next week. In the meantime, I'm sure you guys have a sample app internally, are you able to reproduce it?

Does it only happen on real device or also with Production build and Airplane/Offline mode on simulator?

I tested a release build on a simulator this morning and I wasn't able to reproduce it. Could be because (as far as I know) enabling Airplane mode isn't possible on the iOS simulator. Instead I disabled the wifi on my laptop and tried a bunch to see if I could get it to lock up, but it didn't.

@desmondmc
Copy link
Author

desmondmc commented May 17, 2024

@krystofwoldrich

We were able to reproduce the issue with a release build of our app and the debugger attached. Looks like some kind of deadlock. You can see in this screenshot two threads are waiting on each other (one of which is the UI Thread). At a glance it looks like they're both accessing systemInfo? Maybe that NSURLSession never completes. Anyway, hope this helps get to the bottom of the issue:

deadlock

@kahest
Copy link
Member

kahest commented May 27, 2024

@desmondmc thanks for the details! cc @brustolin @philipphofmann for some eyes from sentry-cocoa point of view. EDIT: possibly resolved by this PR for this issue on sentry-cocoa

@krystofwoldrich
Copy link
Member

@desmondmc
Copy link
Author

5.22.3 fixed the issue! Thanks @kahest @krystofwoldrich

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

No branches or pull requests

3 participants