Skip to content

fix(native): use app .run for crash daemon - #1976

Open
jpnurmi wants to merge 9 commits into
masterfrom
jpnurmi/ref/native-run
Open

fix(native): use app .run for crash daemon#1976
jpnurmi wants to merge 9 commits into
masterfrom
jpnurmi/ref/native-run

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Have the native crash daemon adopt the application's existing .run instead of creating a second unrelated .run, and store daemon logs, minidumps, crash envelopes, and signal-handler scratch files within that .run.

Before this change, every native crash daemon run left its log in the top-level database directory, while every generated minidump remained there after its crash. Neither files were in .run directories, so old-run processing never removed them, so logs accumulated per daemon run and minidumps per qualifying crash.

image

The daemon's unconditional retention of generated minidumps predates PR #1607 and is now redundant. With cache_keep configured, the cache/ directory retains each minidump as a separate .dmp alongside its .envelope, subject to configured cache limits. This provides the same direct debugger access without leaving raw minidumps in the database root indefinitely.

Protect daemon-owned work with a dedicated .run.daemon.lock so old-run processing waits for completion. Keep retry cache and external storage database-global, and leave crashed runs for normal next-launch cleanup.

Tip

Making the native daemon play by the normal .run rules is also a pre-requisite for implementing on_crashed_last_run in a clean way, hooked into the shared "process old runs" mechanism used by all backends:

@jpnurmi jpnurmi changed the title ref(native): use .run for crash daemon ref(native): use app .run for crash daemon Aug 12, 2026
Comment thread src/sentry_database.c
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.05085% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.50%. Comparing base (dcf9623) to head (80a2621).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1976      +/-   ##
==========================================
+ Coverage   74.31%   74.50%   +0.18%     
==========================================
  Files         104      104              
  Lines       25638    25609      -29     
  Branches     4627     4621       -6     
==========================================
+ Hits        19054    19081      +27     
+ Misses       5281     5234      -47     
+ Partials     1303     1294       -9     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Have the native crash daemon adopt the application's existing .run
instead of creating a second unrelated .run, and store daemon logs,
minidumps, crash envelopes, and signal-handler scratch files within
that .run.

Protect daemon-owned work with a dedicated `.run.daemon.lock` so
old-run processing waits for completion. Keep retry cache and external
storage database-global, and leave crashed runs for normal next-launch
cleanup.
@jpnurmi
jpnurmi force-pushed the jpnurmi/ref/native-run branch from d373b92 to d5faff5 Compare August 12, 2026 16:40
Comment thread src/backends/native/sentry_crash_daemon.c
@jpnurmi jpnurmi changed the title ref(native): use app .run for crash daemon fix(native): use app .run for crash daemon Aug 13, 2026
Comment thread src/sentry_database.c Outdated
sentry_value_decref(crash_event);
}

// Send all other envelopes from run folder (logs, etc.) before cleanup

@jpnurmi jpnurmi Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Tip

👆 The other envelopes are now already processed earlier by the sentry__process_run_envelope call above. Such an extra envelope is already covered by test_native_session_tracking.

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