Skip to content

fix(native): Cache failed daemon uploads for retry - #2199

Merged
jpnurmi merged 4 commits into
masterfrom
jpnurmi/fix/native-retry
Oct 16, 2026
Merged

jpnurmi merged 4 commits into
masterfrom
jpnurmi/fix/native-retry

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

The daemon starts without a retry queue, so failed uploads previously used non-retry cache filenames and were not sent on restart as appropriate.

Track retry_enabled independently of the retry instance. Persist full envelopes with retry filenames for the SDK to send on its next start, without enabling retries in the daemon.

Fixes: #2193

@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.

Stale Bugbot comment from a previous run.

Comment thread src/transports/sentry_http_transport.c
Comment thread src/transports/sentry_http_transport.c

@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.

Stale Bugbot comment from a previous run.

Comment thread src/transports/sentry_http_transport.c Outdated
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.63%. Comparing base (6376e9d) to head (abcb1db).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2199      +/-   ##
==========================================
+ Coverage   75.42%   75.63%   +0.20%     
==========================================
  Files         103      103              
  Lines       28254    28244      -10     
  Branches     5177     5173       -4     
==========================================
+ Hits        21310    21361      +51     
+ Misses       5600     5541      -59     
+ Partials     1344     1342       -2     
🚀 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/native-retry branch from 0142378 to 3487560 Compare October 14, 2026 13:22

@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 3487560. Configure here.

Comment thread src/backends/native/sentry_crash_daemon.c
`http_transport_shutdown` sealed the retry queue as soon as the worker
missed its timeout, before `sentry_close` dumped the still-queued send
tasks to disk. A send that failed in between had its enqueue refused and
fell through to the discard branch, so if the worker popped its task
before the dump took the queue lock, the envelope was lost.

Seal from `http_dump_queue` instead. Every caller of the dump is
terminal, and the dump has written the in-flight envelope by then, so a
refused enqueue can no longer drop anything. The seal keeps preventing a
detached worker from caching an envelope the dump already wrote.
The daemon starts without a retry queue, so failed uploads previously
used non-retry cache filenames and were never sent on restart.

Track `retry_enabled` independently of the retry instance. Persist full
envelopes with retry filenames for the SDK to send on its next start,
without enabling retries in the daemon.

The daemon no longer pre-writes crash envelopes with attachment refs or
sweeps the run directory after a clean shutdown. It relies on the
transport's queue dump at exit instead, and clears `retry_enabled` right
after that dump so an upload that was still stuck in the worker is not
cached a second time when it eventually fails.

Fixes: #2193
@jpnurmi
jpnurmi force-pushed the jpnurmi/fix/native-retry branch from 3487560 to f7cb8e2 Compare October 15, 2026 08:35
@jpnurmi
jpnurmi merged commit c549939 into master Oct 16, 2026
70 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/fix/native-retry branch October 16, 2026 11:14
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.

Native backend: crash envelopes cached while offline are never retried (cache_keep=OFFLINE, http_retry=true)

3 participants