Fixing the Next Thousand Deadlocks: Why Buffered Streams Are Broken and How To Make Them Safer

I am fortunate enough to work on a production Rust service (a real one, not cryptocurrency nonsense). Rust virtually eliminates the kinds of stupid bugs and gotchas that are endemic in other languages, making it much easier to develop and maintain our project. Unfortunately, Rust is substantially le...

Click to view the original at

Hasnain says:

This is a surprisingly hard problem that I’m always worried about introducing - I’ve seen this cause issues before too.

“Making these changes won’t be easy, but that doesn’t mean they shouldn’t be done. Before Rust came along, achieving both memory safety and C++ levels of performance in a practical, easy-to-use language seemed impossible. And this change doesn’t even require a new language! It’s just a matter of redesigning a commonly used library to be less error-prone. Hopefully someday, deadlocks too will be an almost-unheard of class of bug. Even if this proposal isn’t suitable for implementation as is, I hope this starts a conversation so we can find better ways to address the problem.”

Posted on 2022-07-31T02:34:47+0000