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

Last crash detection API parity between SDK's

Open Angelodaniel opened this issue 5 months ago • 3 comments

For last-crash detection API across SDKs. With sentry-native, if you're using sentry_get_crashed_last_run(), then you also need to call sentry_clear_crashed_last_run() so you won't redetect an older crash on later runs.

I believe in cocoa it's automatically reset based on: https://github.com/getsentry/sentry-cocoa/blob/main/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_AppState.c#L459

So can we also make sure the native SDK automatically manages this as much as possible?

Angelodaniel avatar Jul 28 '25 10:07 Angelodaniel

Clearing automatically could be problematic if this is called from multiple places. IIRC that was the case when this was originally implemented.

Instead, maybe we should change how it's implemented to avoid the need to clear at all. Maybe we could, for example, have a run identifier (number) which increases on runs/failures?

vaind avatar Aug 04 '25 18:08 vaind

@jpnurmi This also relates to #1303 and might be considered from the POV of that PR (even if not rectified there).

Clearing automatically could be problematic if this is called from multiple places. IIRC that was the case when this was originally implemented.

I am missing context here. What do you mean by "this is called from multiple places"? Threads/processes or just call sites? Because we could make this an option (where the default would be a breaking change if I understood the intent of the issue correctly). Wouldn't the same problem apply to the SDKs that implement it in the proposed manner?

supervacuus avatar Aug 06 '25 11:08 supervacuus