-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
App crash due to a background call to -[UIApplication applicationState]
in -[SentryUIApplication init]
#3836
Comments
Thanks for reporting this, @diogot. This should be an easy fix. There is no guarantee that
But if for example the SDK gets started from a background thread or if somebody interacts with the hub without starting the SDK on a background thread, @brustolin, could you please have a look? |
I'm experiencing this crash as well.
|
Thanks for the additional info @mlch911 we'll have a fix soon |
I have commited a PR to fix this. |
Fix crash when call SentryUIApplication in background thread. #3836 Co-authored-by: Dhiogo Brustolin <[email protected]>
Fix crash when call SentryUIApplication in background thread. #3836 Co-authored-by: Dhiogo Brustolin <[email protected]>
It seems that this was fixed in the main branch, it's great! |
Hello @diogot, most likely until Thursday. |
Awesome, thanks! |
Hey, I tested with release Thread 6 Crashed: |
Should I open a new issues or this can be reopened? |
I reopened the issue @diogot. Thanks for reaching out to us again. |
…try#3855) Fix crash when call SentryUIApplication in background thread. getsentry#3836 Co-authored-by: Dhiogo Brustolin <[email protected]>
Tested on 8.26.0, the crash keeps happening: Thread 5 Crashed: |
…try#3855) Fix crash when call SentryUIApplication in background thread. getsentry#3836 Co-authored-by: Dhiogo Brustolin <[email protected]>
I looked at
UIDevice is |
This can happen (and will be fixed) if you're trying to use SentrySDK from a background thread before starting it. Can you confirm this scenario @diogot? |
We're observing this crash in our CI, now that I looked at the code, I found a workaround. |
Yes. We still need to fix this. |
Platform
tvOS
Environment
Other
Installed
Swift Package Manager
Version
8.23.0
Did it work on previous versions?
It works up to version 8.21.0
Steps to Reproduce
Call
+ (SentryId *)captureError:(NSError *)error withScopeBlock:(void (^)(SentryScope *_Nonnull))block
in a background thread crashes the app due toMain Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
.This is happening in our unit tests, we didn't released to production.
We are using Xcode 15.3.
Expected Result
App did not crash.
Actual Result
App crash with this stack trace:
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 16779, TID: 3695907, Thread name: (none), Queue name: tv.standard.watch-NetworkService, QoS: 25
Backtrace:
4 Services 0x000000010842a4b4 -[SentryUIApplication init] + 244
5 Services 0x000000010841eacc -[SentryDependencyContainer application] + 68
6 Services 0x00000001083d32b4 -[SentryCrashWrapper enrichScope:] + 1096
7 Services 0x00000001083eafc8 -[SentryHub initWithClient:andScope:] + 736
8 Services 0x00000001084107e0 +[SentrySDK currentHub] + 60
9 Services 0x000000010841183c +[SentrySDK captureError:withScopeBlock:] + 80
Are you willing to submit a PR?
No response
The text was updated successfully, but these errors were encountered: