Skip to content

fix: don't sample events captured while handling a crash - #2269

Merged
tustanivsky merged 3 commits into
masterfrom
feat/skip-sampling-in-crash-handler
Oct 29, 2026
Merged

tustanivsky merged 3 commits into
masterfrom
feat/skip-sampling-in-crash-handler

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Events captured while a crash is being handled, e.g. from the on_crash hook, are no longer dropped by sample_rate. Backends already send crashes without sampling, so an event captured as part of the crash now gets the same treatment.

The crash handler nesting depth is tracked in sentry__enter_crash_handler()/sentry__exit_crash_handler(), and the sample_rate roll in sentry__capture_event() is skipped while it is above zero.

The depth is process-wide since inproc handles crashes on a separate handler thread, so events captured on other threads while a crash is being handled skip sampling too.

Related to getsentry/sentry-unreal#1667

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.70%. Comparing base (b99f526) to head (8af9927).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2269      +/-   ##
==========================================
- Coverage   75.71%   75.70%   -0.01%     
==========================================
  Files         103      103              
  Lines       28316    28319       +3     
  Branches     5208     5210       +2     
==========================================
+ Hits        21439    21440       +1     
- Misses       5529     5532       +3     
+ Partials     1348     1347       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tustanivsky
tustanivsky merged commit 20f92f2 into master Oct 29, 2026
71 checks passed
@tustanivsky
tustanivsky deleted the feat/skip-sampling-in-crash-handler branch October 29, 2026 05:16
jpnurmi pushed a commit to nmandelblit/sentry-native that referenced this pull request Oct 29, 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.

3 participants