Rendered at 05:23:39 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
renehsz 2 hours ago [-]
IMO Mutex poisoning is a symptom of the unfortunate decision to unwind panics by default, instead of the much more sane panic="abort".
There are two kinds of errors: Those that you expect to happen in production and should therefore be handled explicitly. And those that should never happen in production and should therefore simply crash the process.
Any sufficiently important production system needs to be able to recover from process crashes anyway (all code runs on physical hardware after all, so in rare instances it could crash despite your code being 100% correct).
If you decide to also try to recover from panics, that introduces another failure recovery mechanism that adds complexity despite being largely redundant. It's easy to get wrong, extremely cumbersome to test and verify, etc.
There can be many unfortunate consequences of the deeply misguided idea of unwinding panics and, worse still, attempting to recover from them, mutex poisoning is just one of them.
charleslmunger 3 days ago [-]
Why does poisoning require a penalty on the uncontended fast path? Using a bit within the futex word would make the acquire operation fail, directing to the show path where extra work can be done without cost.
manwe150 3 hours ago [-]
Agreed. As much as poisoning has its problems, the article seems to barely touch on the main issues with it, like the cost of checking the return value penalizing callers that don’t just discard the result (because rust doesn’t have a zero-cost exception like c++) due to the added branch potentially doubling the cost of an uncontended lock; and once poisoned, it’s unclear why you never want to be able to do any introspection of the failed state afterwards to try to recover or report it
There are two kinds of errors: Those that you expect to happen in production and should therefore be handled explicitly. And those that should never happen in production and should therefore simply crash the process.
Any sufficiently important production system needs to be able to recover from process crashes anyway (all code runs on physical hardware after all, so in rare instances it could crash despite your code being 100% correct).
If you decide to also try to recover from panics, that introduces another failure recovery mechanism that adds complexity despite being largely redundant. It's easy to get wrong, extremely cumbersome to test and verify, etc.
There can be many unfortunate consequences of the deeply misguided idea of unwinding panics and, worse still, attempting to recover from them, mutex poisoning is just one of them.