Watchdog Terminations

This integration tracks watchdog terminations based on heuristics. This feature is available for iOS, tvOS, and Mac Catalyst, works only if the application was in the foreground, and doesn't track watchdog terminations for unit tests.

When a typical unhandled error occurs, the Apple SDK writes a report to disk with the current state of your application, with details like the stack trace, tags, breadcrumbs, and so on, before the app terminates. When the watchdog terminates your app this happens without further notice, which means the SDK can't write a report to disk. A common reason the watchdog can terminate your app is an Out Of Memory problem. If the app is terminated because it hangs, we don't create a watchdog termination event, but instead an AppHangs event is created.

As a result, in the Apple SDK, we track watchdog terminations during the app start based on heuristics, but getting the state of the app when a watchdog termination occurs is challenging. To provide the same state as we do for a typical crash, we would periodically need to store the app state to disk. This would cause a lot of I/O, which in turn could negatively affect the application's performance. To avoid this, watchdog termination events have less context than typical unhandled errors. Breadcrumbs are stored to disk and are added to watchdog termination events to help you figure out where in the app the event happened. This is done by appending the breadcrumbs to an open file, which should have a marginal impact on your app's performance.

When a user launches the app, the SDK checks the following statements and reports a watchdog termination if all of them are true:

  • The app didn't crash on the previous run.
  • The app was in the foreground/active.
  • The user launched the app at least once. When your app was killed by the watchdog during the first launch, the SDK can't detect it.
  • There was no debugger attached to the process of the app. (If there was, our logic would falsely report watchdog terminations whenever you restarted the app in development.)
  • The app was not running on a simulator.
  • The OS didn't update your app.
  • The user didn't update the OS of their device.
  • The user didn't terminate the app manually, and neither did the OS.

If you're interested in the implementation details, you can check out the code to find out more.

If you'd like to opt out of this feature, you can do so using options:

import Sentry

SentrySDK.start { options in
    options.dsn = ""
    options.enableWatchdogTerminationTracking = false

If you disable the enableCrashHandler option, the SDK will disable watchdog termination tracking. This will prevent false positive watchdog termination reporting for every crash.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
Suggest an edit to this page   |  Contribute to Docs   |  

Report a Problem

🎉 Thank you for your feedback! 🙌
Report a problem