Armin Ronacher: abolish Rust lock poisoning — nobody in the wild handles it correctly

Armin Ronacher · rss · 2026-11-25

Armin Ronacher argues Rust's mutex poisoning should be removed or made opt-in, as the libs team discusses defaulting to non-poisoning locks. Key points: PoisonError holds the guard, so error-wrapping patterns cause deadlocks (real bugs in cc-switch, ox-embed-server); one panic turns into permanent failure as thread pools and tokio tasks survive and every later lock().unwrap() panics (RLS, Mozilla services where PoisonError hit #5 in crash stats, Neon safekeeper, cargo/deno/polars/rustc test suites); intoinner() recovery re-triggers side effects since clearpoison only landed in 1.77; std itself ignores poisoning internally, as do tokio, wasmtime, and rust-analyzer. He also questions why RefCell doesn't poison while async code catches panics just as often, and proposes std::sync::nonpoison as default with an explicit Poison<T> opt-in wrapper.

Original post →

More from coding & agent

coding & agent channel →