Why Ruby’s Timeout is dangerous (and Thread.raise is terrifying) (2015)

The author of the article had a bad experience with Ruby’s Timeout feature, leading to a difficult bug that was challenging to track down. The implementation of Timeout in Ruby uses Thread.raise, which can result in unexpected exceptions being raised at any point in the code, causing potential chaos. The author compares this to how other languages handle similar situations, highlighting the dangers associated with methods like Thread.stop in Java. The author concludes that the general premise of a timeout method that interrupts arbitrary code is fundamentally flawed and suggests looking at Java’s more controlled approach to thread interruption as a better alternative.

https://jvns.ca/blog/2015/11/27/why-rubys-timeout-is-dangerous-and-thread-dot-raise-is-terrifying/

To top