Skip to content

fix(native): Recover interrupted crash reports - #2330

Open
jpnurmi wants to merge 4 commits into
v1from
jpnurmi/fix/native-recover
Open

jpnurmi wants to merge 4 commits into
v1from
jpnurmi/fix/native-recover

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Originates from:

If the crash daemon was killed abruptly, or had not attached yet, the crash was lost: the next launch deleted its __sentry-event with the old run folder. This is more likely on Android, where the daemon runs in a service process that the system can kill independently of the app, for example under memory pressure, and that may not have connected yet when the app crashes.

Recover the event instead. The daemon removes the file once it has sent the crash or kept its own envelope.

If the crash daemon is killed abruptly, or has not attached yet, the
crash is lost: the next launch deletes its `__sentry-event` with the
old run folder. This is more likely on Android, where the daemon runs
in a service process that the system can kill independently of the
app, for example under memory pressure, and that may not have connected
yet when the app crashes. Recover the event instead. The daemon removes
the file once it has sent the crash or kept its own envelope.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6e1120e. Configure here.

Comment thread src/backends/sentry_backend_native.c Resolved
A daemon killed after writing `__sentry-crash.envelope` but before
removing `__sentry-event` left both files, and the next launch invoked
`on_crashed_last_run` for each. Send the daemon's envelope instead and
remove the event.
@jpnurmi
jpnurmi added this pull request to stack #2331 November 20, 2026 14:13
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.94737% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.49%. Comparing base (87c2032) to head (a6dc761).

Additional details and impacted files
@@            Coverage Diff             @@
##               v1    #2330      +/-   ##
==========================================
- Coverage   75.72%   75.49%   -0.23%     
==========================================
  Files         105      105              
  Lines       30936    30985      +49     
  Branches     5775     5784       +9     
==========================================
- Hits        23426    23392      -34     
- Misses       6075     6180     +105     
+ Partials     1435     1413      -22     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant