Skip to main content

ShutdownStats

Struct ShutdownStats 

Source
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: u64

Executor::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: u64

Box-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: u64

Normal 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: u64

Cross-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

Source§

fn clone(&self) -> ShutdownStats

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ShutdownStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ShutdownStats

Source§

fn default() -> ShutdownStats

Returns the “default value” for a type. Read more
Source§

impl Copy for ShutdownStats

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.