pub struct ShutdownStats {
pub aborted_unwinds: u64,
pub leaked_box_tasks: u64,
pub unbalanced_normal_shutdowns: u64,
pub cross_queue_undrained: u64,
}Expand description
Counters for abnormal-shutdown paths. Snapshot returned by
Runtime::shutdown_stats.
All counters are 0 for a clean shutdown. Any non-zero counter is a
signal to investigate — the runtime hit a defensive code path that
should be unreachable in normal operation. Users own their
observability stack; the runtime emits no logs of its own (per
PR 2’s design — see ShutdownStats doc-comment for the user
pattern).
§Example
let handle = runtime.shutdown_stats(); // Arc<ShutdownStatsAtomics>
drop(runtime); // counters fire during drop
let stats = handle.snapshot(); // plain ShutdownStats for matching
if stats.aborted_unwinds != 0
|| stats.leaked_box_tasks != 0
|| stats.unbalanced_normal_shutdowns != 0
|| stats.cross_queue_undrained != 0
{
// user's own observability — log to wherever they want
my_logger::warn!("nexus runtime shutdown: {stats:?}");
}Fields§
§aborted_unwinds: u64Executor::drop hit the slab-unwinding 100ms-wait-then-abort
path. Indicates a producer thread held a slab task ref past
Runtime drop during a panic. The process aborted before this
counter could be read — non-zero means a previous run aborted
(the counter is preserved across the abort by being stored in
the executor’s state, but reading it requires the runtime to
have survived; in practice this counter is set just before
abort and serves as a guarantee the abort path was hit if the
runtime somehow survived).
leaked_box_tasks: u64Box-allocated tasks the executor couldn’t free during shutdown unwinding (outstanding cross-thread refs, leaked to avoid double-panic). Memory leak, not UAF. Box memory is reclaimed at process exit.
unbalanced_normal_shutdowns: u64Normal shutdown (no panic in flight) found an all_tasks entry
with rc > 0. Debug builds panic. Release builds eprintln +
leak. Indicates a producer didn’t release refs before Runtime
drop — call Runtime::shutdown_quiesce
before drop to surface this as an Err instead.
cross_queue_undrained: u64Cross-thread queue entries that landed after Runtime drop and were never drained (the leak path inherited from PR 1a’s dispose_terminal off-thread branch). Pure memory leak.
Trait Implementations§
Source§impl Clone for ShutdownStats
impl Clone for ShutdownStats
Source§fn clone(&self) -> ShutdownStats
fn clone(&self) -> ShutdownStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more