-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
We're getting killed by the watch dog during background audio recording. Do we need to do anything special to avoid sentry running in the background? #4872
Comments
Thanks for reporting this @bryan1anderson.
Please try not starting Sentry and double-check if you're still getting the watchdog cleanup. If yes, then our SDK isn't causing them. If no, please also share how you start the Sentry SDK to help us to investigate this. The easiest for us to investigate would be a small sample project to reproduce the problem if it isn't too much to ask. And for clarification: What exactly do you mean by watch dog cleanup? Do you mean iOS terminating your app? |
Sure thing! @philipphofmann https://stackoverflow.com/questions/71656047/why-is-my-react-native-app-terminating-in-the-background-while-recording-ios-r We went on a less than fun journey to arrive at virtually 0% CPU usage before we started to reliably avoid background termination. This is not very well documented by Apple. But several developers solution was to destroy nearly everything when users transition to background recording. We added Sentry to understand just how significant that impact was.. and now we're not sure if we just have better observability or if observation itself is what is causing the influx of these newer reports. I went on another sleuthing expedition to identify background CPU usage and found a few "heartbeat" tasks that were running and ended them. The only part of the project I do NOT have visibility on for what happens in the background is Sentry. These are hard to reproduce as iOS determines when this would be necessary by factors including age/condition of the battery. Basically I'm looking to know: Obviously I would prefer to keep it alive if I can essentially say: Sentry, you can only cache logs right now and you need to disable any repetitive "heartbeat" tasks and ONLY perform any work when I tell you to. |
When your app moves to the background, the SentrySDK stops multiple services, such as tracking slow and frozen frames. I can't confirm that we are using 0% CPU when your app is in the background, but the overhead should be very low. It also depends on which features you enable in
I'm sorry, I'm not sure what you mean by URL session/uploads.
You can only achieve 0% usage if you close the SDK, by calling SentrySDK.close.
Call SentrySDK.close. |
By uploads I meant whatever http requests you use to upload the logs. Okay SentrySDK.close sounds good.. I'll see what we can figure out. Thanks so much |
Platform
iOS
Environment
Production
Installed
Swift Package Manager
Version
8.43.0
Xcode Version
16.2
Did it work on previous versions?
No response
Steps to Reproduce
Enable background audio recording
Background app
Expected Result
Sentry correctly limits its CPU usage to avoid anything that the watch dog would terminate. In our experience that essentially means 0% CPU usage, no UI updates, no networking.
Actual Result
We are getting unknown watch dog cleans ups.. and we're not sure if sentry is causing them.
Are you willing to submit a PR?
No response
The text was updated successfully, but these errors were encountered: