pub struct LockStallTracker { /* private fields */ }Expand description
Stamps for handle locks found held, plus the ticker’s heartbeat.
Why: see the module docs. A std mutex guards the table because every
critical section is a map operation with no .await.
What: the stamp table, a poisoned flag, the health-path rate limit, and the
ticker heartbeat. A poisoned lock is recovered with into_inner so stamps
stay readable, and Self::degraded_at reports it from then on.
Test: lock_stall_tests.rs.
Implementations§
Source§impl LockStallTracker
impl LockStallTracker
Sourcepub fn sweep_if_due(
self: &Arc<Self>,
registry: &PalaceRegistry,
interval: Duration,
)
pub fn sweep_if_due( self: &Arc<Self>, registry: &PalaceRegistry, interval: Duration, )
Sweep unless a sweep ran within interval.
Why: memory.health is polled about once a second. Sweeping from it
keeps stamps fresh even where no ticker runs, and the rate limit keeps
the cheap path cheap. The ticker sweeps through here too, so the two
paths share one rate limit instead of doubling each other’s work.
What: records the sweep time under the rate-limit lock, then sweeps.
Test: health_sweeps_are_rate_limited_to_the_interval,
a_ticker_sweep_records_itself_against_the_health_rate_limit.
Sourcepub fn oldest_stall_at(&self, now: Instant) -> Option<StalledLock>
pub fn oldest_stall_at(&self, now: Instant) -> Option<StalledLock>
The oldest stamp’s age at now, or None when nothing is stamped.
Why: an injected now lets tests age a stamp without sleeping.
Test: a_lock_held_past_the_threshold_ages_past_it_and_clears_on_release.
Sourcepub fn degraded_at(&self, now: Instant) -> Option<String>
pub fn degraded_at(&self, now: Instant) -> Option<String>
Why the tracker cannot vouch for its stamps at now, if it cannot.
Why: a stopped ticker or poisoned state leaves stall detection partial.
Reporting nothing would make health read ok on a signal that is gone.
What: Some(reason) when a started ticker has missed
three beats (TICKER_GRACE_INTERVALS), or when tracking state was
poisoned. The stamp table is touched first: the poison flag is set by
Self::guard, so a caller that has not read the stamps yet would
otherwise see a stale false and report healthy.
Test: a_ticker_that_stops_beating_reports_degraded,
a_poisoned_tracker_keeps_its_stamps_and_reports_degraded,
degraded_at_sees_poison_without_a_prior_stamp_read.
Trait Implementations§
Source§impl Debug for LockStallTracker
impl Debug for LockStallTracker
Auto Trait Implementations§
impl !Freeze for LockStallTracker
impl RefUnwindSafe for LockStallTracker
impl Send for LockStallTracker
impl Sync for LockStallTracker
impl Unpin for LockStallTracker
impl UnsafeUnpin for LockStallTracker
impl UnwindSafe for LockStallTracker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more