Jake Cronin
Jake Cronin

Reputation: 1062

Does Bugsnag detect background oom errors on iOS?

Does anyone know how to turn on background OOM reporting on Bugsnag?

Bugsnag has an article titled Automatic detection and reporting of OOM errors that explicitly mentions background OOMs being disabled by default, but the linked resource for turning on background OOMs (here) makes no mention of background OOMs...

Screenshot from the article: Screenshot from Bugsnag Article

Does anyone know how to turn on background OOM reporting on Bugsngag? Is this actually possible?

Upvotes: 0

Views: 399

Answers (2)

Jake Cronin
Jake Cronin

Reputation: 1062

Additional helpful content from the Bugsnag support team:

  1. Is a thermal kill (from your documentation) the same as a CPU Resource Limit termination as reported in the Energy Exception Reports section of the Xcode Organizer (link to WWDC video on CPU Resource Limits)? I do not believe so because I see a few energy exceptions in our Xcode Organizer, but I cannot find any corresponding errors in bugsnag. If not, does Bugsnag detect CPU Resource Limit Terminations?

These are not the same thing. CPU resource limit terminations are not something Bugsnag currently detects. Thermal Kills would be reported by Apple as as EXC_CRASH (SIGKILL) with exception code 0xc00010ff (https://developer.apple.com/documentation/xcode/understanding-the-exception-types-in-a-crash-report#EXC_CRASH-(SIGKILL))

  1. Does Bugsnag detect terminations due to App Hangs in the background on iOS? I see a couple of App Hang terminations in my bugsnag dashboard, but they are all foreground-only.

No. We used to when we initially introduced App Hang detection. However, from v6.9.0 (through PR#1075) we ignore app hangs that occur in the background as they were found to be unreliable and contributed to many false-positives. From the PR, one example is CABackingStoreCollectBlocking() hanging while it cleans up graphics resources. It has been reported that this can take up to 10 seconds, and therefore cause the app to be terminated by the system watchdog resulting in a false-positive.

  1. Does Bugsnag detect Illegal Instruction terminations (apple documentation) in the background and foreground on iOS? I have no illegal instruction terminations in my bugsnag dashboard, but I want to confirm whether this is due to a Bugsnag limitation or an issue with my app.

Yes, these would be reported as EXC_BAD_INSTRUCTION (or SIGILL if enabledErrorTypes.machExceptions was disabled).

  1. Does bugsnag detect background terminations due to Background Task Timeouts or File-Lock (apple documentation)?

Bugsnag does not detect either of these. Bugsnag is generally unable to detect EXC_CRASH (SIGKILL) crashes because the OS does not inform apps about them. This is why we use heuristics to detect OOMs and fatal App Hangs, and why backgrounding the app can cause false-positive App Hangs because the main thread monitor can no longer be relied upon when it's backgrounded.

In the background Bugsnag detects and reports Language Exception Crashes, Memory Access Crashes (EXC_BAD_ACCESS), EXC_BREAKPOINT (SIGTRAP) which covers e.g. Swift Runtime Errors, EXC_BAD_INSTRUCTION (SIGILL), EXC_CRASH (SIGABRT) and EXC_ARITHMETIC.

Upvotes: 1

Nick Dowell
Nick Dowell

Reputation: 2120

Background OOM detection was removed because it generates to many false positives to be useful

Once an app is in the background and no longer running iOS can kill / remove it from memory for any number of reasons. There's no reliable way (yet) for an app to determine why its previous run was killed.

Upvotes: 1

Related Questions