Available on crate feature
block-detect only.Expand description
Heuristic blocking-call detection inside async tasks.
Available with the block-detect feature.
When an async task contains a synchronous I/O call (e.g.
std::fs::read instead of tokio::fs::read), the runtime cannot
preempt it, and other tasks on the same worker stall. This module
provides a heuristic detector: wrap an async block, and if it
takes more than max_no_yield real time without yielding, flag it.
§Heuristic, not deterministic
This cannot perfectly distinguish “blocking call” from “long synchronous work between awaits”. A long pure-CPU section also looks like blocking from this detector’s perspective. Treat the verdict as a signal to investigate, not a proof.
Functions§
- detect_
blocking - Wrap a future and emit a
CheckResultflagging suspected blocking calls inside it.