sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

MetricKit Crash Fallback

Open philipphofmann opened this issue 2 years ago • 6 comments

Description

If SentryCrash cannot capture a crash report, the SDK can use MetricKit crash data as a fallback. This would increase the reliability of our SDK.

It can happen that SentryCrash can't capture and report some types of crashes MetricKit can. The watchdog termination integration currently reports such crashes as watchdog terminations. Before doing that, the SDK could wait for MetricKit to report a crash. If it does, the SDK creates a normal crash event and sends it to Sentry, instead of a watchdog termination event. Since iOS 15, this happens almost immediately when starting the app again after a crash.

The goal is not to replace SentryCrash with MetricKit, as with SentryCrash the SDK can store the app's current state to disk, which is impossible with MetricKit.

philipphofmann avatar Jan 19 '23 08:01 philipphofmann

We have to ensure we dont have duplicate crashes report.

brustolin avatar Feb 01 '23 13:02 brustolin

Another thing to consider is that if Sentry is able to capture an event, but MetricKit has an additional context (does it?), we could empower the error sent to Sentry with this extra context.

marandaneto avatar Feb 02 '23 16:02 marandaneto

but MetricKit has an additional context (does it?)

I don't think that it has, but worth investigating.

philipphofmann avatar Feb 02 '23 17:02 philipphofmann

Hi @philipphofmann,

We are seeing a number of watchdog termination errors reported in Sentry. Unfortunately, we haven't been able to reproduce on a local build and the breadcrumbs we have at the moment don't seem to help us much. In the issue description, this piece caught my eye:

It can happen that SentryCrash can't capture and report some types of crashes MetricKit can. The watchdog termination integration currently reports such crashes as watchdog terminations.

Checking my understanding here... could we be seeing watchdog termination errors reported simply because the sentry SDK wasn't able to capture and report what the crash was? In some cases, it sounds like watchdog termination is the fallback that sentry reports?

chaseklingelzen avatar Jan 04 '24 20:01 chaseklingelzen

Checking my understanding here... could we be seeing watchdog termination errors reported simply because the sentry SDK wasn't able to capture and report what the crash was? In some cases, it sounds like watchdog termination is the fallback that sentry reports?

Yes, that could be the case, @chaseklingelzen. We don't expect the number to be high, though, and we haven't heard anything like that from our users yet, but you never know. Implementing this issue would tell us how high that number is.

philipphofmann avatar Jan 05 '24 10:01 philipphofmann

Checking my understanding here... could we be seeing watchdog termination errors reported simply because the sentry SDK wasn't able to capture and report what the crash was? In some cases, it sounds like watchdog termination is the fallback that sentry reports?

Yes, that could be the case, @chaseklingelzen. We don't expect the number to be high, though, and we haven't heard anything like that from our users yet, but you never know. Implementing this issue would tell us how high that number is.

Great, thanks @philipphofmann!

chaseklingelzen avatar Jan 05 '24 15:01 chaseklingelzen