Repository navigation
Crash reporting: keep capture armed through a panic, retry unreadable envelopes, read nothing without a DSN - #168
Merged
Conversation
… read no crash data without a DSN Three follow-ups to the native crash-report import (#155): - The telemetry Guard no longer stops the native backend or deletes its database while the thread is unwinding a panic. A panic that unwinds plex_run's frame aborts at the extern "C" boundary a moment later, and that abort is the crash the backend exists to capture. A clean exit still shuts it down as before. - A pending native envelope that fails to READ (metadata, open or read I/O error) is left on disk for the next boot and counted as deferred=, instead of being deleted as malformed. Only a non-regular file, an oversized file, or bytes the parser refuses are deleted. - Crash data (the crash log and the native envelopes) is read only when crash consent is given AND the build carries a Sentry DSN, through one gate, crashreport::may_read_crash_data. A no-DSN build reads nothing, moves no watermark and deletes no envelope. Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Sep 19, 2026
GLinnik21
added a commit
that referenced
this pull request
Sep 19, 2026
PR #168 made the telemetry `Guard`'s Drop check `std::thread::panicking()` and return early, so a panic unwinding out of `plex_run` no longer tears the native crash backend down before the boundary abort. `panic` still exercises the extern "C" callback shape; `unwind` is the regression test for the Guard fix itself, panicking directly in `crash_on_purpose` so the unwind crosses `plex_run`'s own frame before aborting at its extern "C" boundary. Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three follow-ups to #155.
A: a panic unwinding out of
plex_runswitched off native capture before the abortDefect.
telemetry::native::Guard'sDropalways ranstop()andremove_database(). A panic that unwindsplex_run's frame dropsAppand the Guard with it, which stopped the native backend and deleted its database. Then theextern "C"boundary aborted with no native handler installed, so no envelope was written.Red test.
telemetry::native::tests::a_guard_dropped_while_unwinding_keeps_the_native_databasefailed with:a Guard dropped while unwinding a panic deleted the native database, so the abort that follows is captured by nothing.Fix.
Drop for Guardnow returns early whenstd::thread::panicking(). A clean exit still shuts the backend down exactly as before, anda_guard_dropped_on_a_clean_exit_tears_the_backend_downcovers that branch. Thecrashtest=panicdoc indev.rssaid a straightpanic!loses the envelope, which is no longer true, so it now says so. The extern "C" callback path stays because it matches how a real panic under libav dies.B: a native envelope that briefly failed to READ was deleted
Defect. In
read_pending, any failure in the metadata, open, read or parse chain was counted asrejectedand the file was deleted. A transient I/O error lost the crash report for good.Red test.
telemetry::native::tests::an_unreadable_envelope_is_deferred_and_a_malformed_one_deleted(a valid envelope made mode 0000, next to a malformed one) failed with:an envelope that failed to OPEN was deleted instead of being left for the next boot.Fix. A new
load_envelopesorts each file into Ready, Rejected, Deferred or Vanished:MAX_RECORD, or bytes that were read and then refused by the parser.deferred=): a metadata, open or read I/O error.A file that stays unreadable for good is never deleted and costs one failed read per boot. The doc comment says this.
C: the crash log was read in a build with no Sentry DSN
Defect.
recover_pendingchecked onlyconsent::allows_errors(). A build with no DSN still read the crash log and spooled records that could never be sent. It also moved the watermark past those records.Red test.
telemetry::crashreport::tests::a_build_without_a_sentry_dsn_reads_no_crash_datafailed with:a build with no Sentry DSN read the crash log and spooled 1313 bytes it can never send.Fix. A single gate,
crashreport::may_read_crash_data()(allows_errors() && has_sentry()), now guards both the crash log inrecover_pendingand the native envelopes innative::read_pending.native::import_allgoes throughread_pending, so it is covered too. A no-DSN build reads nothing, writes no watermark and deletes no envelope. To make these paths testable,recover_pending_at(path)andread_pending_in(dir)were extracted without changing behaviour.Gates (run on the committed tree)
make check: passed (lib suite 3867 passed, hostsim 3914 passed, 0 failed). This checkout has no DSN configured, so test C ran its assertions rather than returning early.CARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml --lib --no-default-features: passed.make(ARM cross-build): passed.No TV was used.
🤖 Generated with Claude Code