Description
Follow-up from PR #6695 (#6693). While fixing the SIGTERM-flush gap for log_guard/chrome_guard, the review chain (critic + reviewer) found that Ctrl-C / SIGINT handling has the same root-cause gap and is out of scope for #6693, but should be tracked separately.
early_ctrlc (src/runner.rs:1650-1654) calls std::process::exit(130) directly when Ctrl-C is pressed. process::exit runs no destructors at all, so it bypasses TracingGuards::drop (and therefore both the log_guard and chrome_guard take-once-cell flush logic added in #6683/#6692/#6693) entirely — not just the theoretical SIGTERM race window, but every single Ctrl-C during the period early_ctrlc is live (from init_tracing at src/runner.rs:867 until early_ctrlc.abort() at src/runner.rs:4040 — i.e. essentially all of bootstrap and dispatch).
On non-Unix platforms, spawn_sigterm_flush_task is a no-op (SIGTERM handling is Unix-only), so Ctrl-C's process::exit path is the only termination route available — meaning any equivalent of the #6693 truncation bug is not fixed at all on non-Unix.
Also flagged: the doctor subcommands (src/runner.rs:1140, 1156, 1172) call process::exit directly in similar fashion and share the same root cause.
Expected Behavior
Determine whether early_ctrlc and the doctor subcommands' process::exit calls should instead route through the same take-once-cell flush mechanism (e.g. have the Ctrl-C handler flush the guard cells before exiting, mirroring spawn_sigterm_flush_task's approach for SIGTERM), or whether the risk/cost tradeoff differs enough (Ctrl-C is an interactive, user-initiated action rather than an external supervisor's pkill, so data loss expectations may differ) to leave as-is with just accurate documentation.
Reproduction Steps
- Run a live session with logging enabled (
RUST_LOG=debug, file output configured) and a burst of log writes in flight.
- Press Ctrl-C during that burst (or during
init_tracing through early_ctrlc.abort()).
- Inspect the resulting log file / local Chrome trace file for truncation or a missing tail.
Environment
- Version: unreleased (main, as of 2026-07-28)
- Relevant code:
src/runner.rs (early_ctrlc, doctor subcommand process::exit call sites), src/tracing_init.rs (TracingGuards::drop, spawn_sigterm_flush_task)
Description
Follow-up from PR #6695 (#6693). While fixing the SIGTERM-flush gap for
log_guard/chrome_guard, the review chain (critic + reviewer) found that Ctrl-C / SIGINT handling has the same root-cause gap and is out of scope for #6693, but should be tracked separately.early_ctrlc(src/runner.rs:1650-1654) callsstd::process::exit(130)directly when Ctrl-C is pressed.process::exitruns no destructors at all, so it bypassesTracingGuards::drop(and therefore both thelog_guardandchrome_guardtake-once-cell flush logic added in #6683/#6692/#6693) entirely — not just the theoretical SIGTERM race window, but every single Ctrl-C during the periodearly_ctrlcis live (frominit_tracingatsrc/runner.rs:867untilearly_ctrlc.abort()atsrc/runner.rs:4040— i.e. essentially all of bootstrap and dispatch).On non-Unix platforms,
spawn_sigterm_flush_taskis a no-op (SIGTERM handling is Unix-only), so Ctrl-C'sprocess::exitpath is the only termination route available — meaning any equivalent of the #6693 truncation bug is not fixed at all on non-Unix.Also flagged: the doctor subcommands (
src/runner.rs:1140,1156,1172) callprocess::exitdirectly in similar fashion and share the same root cause.Expected Behavior
Determine whether
early_ctrlcand the doctor subcommands'process::exitcalls should instead route through the same take-once-cell flush mechanism (e.g. have the Ctrl-C handler flush the guard cells before exiting, mirroringspawn_sigterm_flush_task's approach for SIGTERM), or whether the risk/cost tradeoff differs enough (Ctrl-C is an interactive, user-initiated action rather than an external supervisor'spkill, so data loss expectations may differ) to leave as-is with just accurate documentation.Reproduction Steps
RUST_LOG=debug, file output configured) and a burst of log writes in flight.init_tracingthroughearly_ctrlc.abort()).Environment
src/runner.rs(early_ctrlc, doctor subcommandprocess::exitcall sites),src/tracing_init.rs(TracingGuards::drop,spawn_sigterm_flush_task)