Skip to content

[0.17] fix!: align last-crash detection with other SDKs - #2023

Open
jpnurmi wants to merge 6 commits into
masterfrom
jpnurmi/fix/clear-crashed-last-run
Open

[0.17] fix!: align last-crash detection with other SDKs#2023
jpnurmi wants to merge 6 commits into
masterfrom
jpnurmi/fix/clear-crashed-last-run

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Cache the crash state and consume <db>/last_crash during sentry_init() by default. This aligns sentry-native with other Sentry SDKs and prevents the same crash from being reported on every later run. sentry_clear_crashed_last_run() is now deprecated.

The Android NDK integration retains the marker because sentry-java reads its timestamp to mark and end the previous native session, then deletes it:

Known getsentry downstream callers can remove their now-redundant clear calls:

Close: #1325

Cache the crash state and consume `<db>/last_crash` during
`sentry_init()` on non-Android platforms. This prevents the same crash
from being reported on every later run when an embedding SDK does not
call `sentry_clear_crashed_last_run()`.

Keep the marker on Android, because sentry-java reads its timestamp to
mark and end the previous native session, then deletes the marker.
Removing it during native initialization would lose both the crash
evidence and its timestamp:
https://github.com/getsentry/sentry-java/blob/1321b401f62077a3f93f6b72d7728a1400d58e04/sentry/src/main/java/io/sentry/PreviousSessionFinalizer.java#L82-L121

Known getsentry downstream callers already clear the marker after
initialization or after reading the cached state:

- https://github.com/getsentry/sentry-dotnet/blob/44252011b7ec233c165e874a4998a94e83ab5341/src/Sentry/Platforms/Native/CFunctions.cs#L157-L161
- https://github.com/getsentry/sentry-unity/blob/3a8c5122ff02eb68be4c0de268ee04507bf2ddbd/src/Sentry.Unity.Native/SentryNativeBridge.cs#L142-L146
- https://github.com/getsentry/sentry-unreal/blob/5d255bce9185a7437ff5497281d2822b76dbe30b/plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentrySubsystem.cpp#L697-L703

Close: #1325
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.40%. Comparing base (162f97a) to head (17b9dc0).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2023      +/-   ##
==========================================
+ Coverage   74.35%   74.40%   +0.05%     
==========================================
  Files         104      104              
  Lines       26518    26521       +3     
  Branches     4824     4828       +4     
==========================================
+ Hits        19717    19734      +17     
+ Misses       5454     5443      -11     
+ Partials     1347     1344       -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jpnurmi
jpnurmi force-pushed the jpnurmi/fix/clear-crashed-last-run branch from e8dd12b to 73b7239 Compare August 25, 2026 14:54
@jpnurmi jpnurmi changed the title fix!: align last-crash detection with other SDKs [0.17] fix!: align last-crash detection with other SDKs Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Last crash detection API parity between SDK's

2 participants