Repository navigation
Description
With the native backend, SENTRY_CACHE_KEEP_OFFLINE and http_retry enabled, a crash that happens while the network is unavailable is written to <database>/cache/, but it is never sent afterwards: neither by the retry queue of the restarted app nor by any later sentry_init. The envelope and its .dmp sidecar stay in the cache until cache_max_age / cache_max_size pruning deletes them.
Regular events captured by the app process while offline are retried correctly. Only envelopes sent by the sentry-crash daemon are affected.
As far as I can tell the cause is this:
- The daemon starts its transport with
http_retrydisabled on purpose and only enables the option aftersentry__transport_startup(src/backends/native/sentry_crash_daemon.c, the "Set http_retry after transport startup …" comment). So the daemon's HTTP transport hasstate->retry == NULL. - When the upload fails,
http_send_taskfalls into thecache_keepbranch and writes the envelope withretry_count = -1(src/transports/sentry_http_transport.c):This produces a bareif (!state->retry && state->cache_keep && sentry__run_write_cache(state->run, envelope, -1)) {
<uuid>.envelopefilename. - The retry queue skips bare filenames because it treats them as "kept" entries (
src/sentry_retry.c):if (!sentry__parse_cache_filename(fname, &ts, &count, &uuid) || count < 0) { continue; }
So with KEEP_OFFLINE an offline crash ends up in the "keep" format meant for KEEP_ALWAYS and exhausted retries, and no process ever picks it up. The same code is on master.
When does the problem happen
- During build
- During run-time
- When capturing a hard crash
Environment
- OS: macOS 26, arm64. The code path is platform-independent, so it should affect Windows and Linux as well (not verified there).
- Compiler: AppleClang (Xcode 27)
- CMake version and config: 3.31.8,
SENTRY_BACKEND=native,SENTRY_TRANSPORT=curl,SENTRY_BUILD_SHARED_LIBS=OFF, sentry-native 0.17.2
Steps To Reproduce
sentry_options_t *options = sentry_options_new();
sentry_options_set_dsn(options, "<dsn>");
sentry_options_set_database_path(options, "<db>");
sentry_options_set_cache_keep(options, SENTRY_CACHE_KEEP_OFFLINE);
sentry_options_set_http_retry(options, 1);
sentry_options_set_debug(options, 1);
sentry_init(options);
// disconnect the network (or make the DSN host unreachable)
sentry_crash(); // or *(volatile int *)0 = 0;- Run the snippet with the network disconnected and let it crash.
<db>/cache/now contains<uuid>.envelopeand<uuid>.dmp.- Reconnect the network and start the app again with the same options.
- The crash is never delivered. The files stay in
<db>/cache/across any number of restarts. Events captured by the app itself while offline are delivered after step 3.
Log output
Cache directory after several online restarts. Crash envelopes from the daemon are bare <uuid> files and are never picked up:
<db>/cache/
2da2ad1e-bc5f-45c2-4fb3-57afde8beaee.envelope (crash event, written by sentry-crash)
c235adee-70b1-4ec3-d905-13d7589567ce.envelope (crash event, written by sentry-crash, previous day)
6875b998-56f0-4a5e-1feb-2c590a5c73a3.envelope (session)
73335c10-f9ef-4240-c1d7-6c19e490f0ef.envelope (session)
After renaming one of them to 1791879785000-0-7dadbb84-a051-4d05-81e6-a90b4ce2d3b0.envelope, the next start sent it and removed it, along with the 7dadbb84-….dmp sidecar.
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
linear-code commentedon Oct 13, 2026
NATIVE-236
jpnurmi commentedon Oct 13, 2026
Thanks for bringing it up! Retries are intentionally disabled in the daemon on shutdown, but it should indeed still respect the client-side retry option while caching envelopes that failed to send.
fix(native): Cache failed crash uploads for retry
fix(native): Cache failed daemon uploads for retry (getsentry#2199)