Conversation
Before "revert separate caching folder implementation" #1461
Cast cache_max_age to time_t to avoid implicit signedness conversion between uint64_t and time_t. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add explicit static_cast<time_t>() for cache_max_age to fix -Wsign-conversion warning on Windows with clang-cl. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4dd6c5e to
ff864c4
Compare
For consistency with time-related operations throughout the codebase. This adds a time.h dependency to the public header, but it's a lightweight standard C header available since C89. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Subtract file size from accumulated_size when a file is pruned (by age or size). Previously, pruned files' sizes were still counted, causing subsequent valid files to be incorrectly pruned when both cache_max_age and cache_max_size were set. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ted_reports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…hpad-offline-caching
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| } else if (state->db->DeleteReport(report.uuid) | ||
| != crashpad::CrashReportDatabase::kNoError) { | ||
| SENTRY_WARNF("failed to delete \"%s\"", filename.c_str()); | ||
| } |
There was a problem hiding this comment.
Partial cache file causes report deletion and data loss
Medium Severity
If sentry_envelope_write_to_path fails but leaves a partial/corrupt file on disk, the next startup will see sentry__path_is_file(out_path) return true, skip rewriting the envelope, and proceed to call DeleteReport — permanently deleting the Crashpad report while only a corrupt envelope remains in cache. The sentry__path_is_file check doesn't validate the file's integrity, so a half-written file from a previous failed attempt is treated as a successfully cached envelope.
There was a problem hiding this comment.
Not sure... To validate the file's integrity, we would either have to store the checksum somewhere or parse the previously written envelope. 🤔
The lack of atomic (temp+rename) file writes could bite in several places in sentry-native. Another scenario: crash during envelope write -> truncated .envelope on disk -> next sentry_init() calls sentry__process_old_runs() -> sentry__envelope_from_path() reads truncated buffer as raw payload -> corrupted envelope sent to Sentry.


Converts completed Crashpad reports to Sentry envelopes for offline caching.
<db>/completed/<db>/cache/Depends on:
feat: offline caching (inproc & breakpad) #1490ref(crashpad): pass predefined report ID #1488ref: exposemerge_breadcrumbsfor crashpad offline caching #1491feat: addsentry__value_from_msgpack#1492See also: