In defense of lock poisoning in Rust · sunshowers
There’s recently been some discussion about the benefits and downsides of lock (mutex) poisoning in Rust, spurred by a recent proposal to make the default mutex non-poisoned, i.e. silently unlock on panic (see also, recent discussion on Hacker News). As a passionate defender of lock poisoning, I thought I’d gather and write about my thoughts on this matter. To summarize, I believe: Unexpected cancellations in critical sections cause real harm to system correctness. Lock poisoning is an important part of ensuring the correctness of critical sections in Rust. Poisoning applies more generally than mutexes, and providing an easy way to track that (via e.g. a Poison wrapper) is valuable. While there is conceptual elegance in separating out locking from poisoning on panic, the importance of lock poisoning overrides these concerns. What is poisoning? Rust, like most multithreaded languages,...
In defense of lock poisoning in Rust