Ruby's timeout is a disaster for multi-threaded processes, using it is risky at best. More info:

(NOTE: Due to an issue migrating my blog from one Google account to another, this URL now points at a *copy* of the original post . If you would like to add further comments, please do so there.) I'm taking a break from some bug fixing to bring you this public service announcement: Ruby's Thread#raise, Thread#kill, and the timeout.rb standard library based on them are inherently broken and should not be used for <span style="font-weight: bold;">any purpose</span>. And by extension, net/protocol.rb and all the net/* libraries that use timeout.rb are also currently broken (but they can be fixed). I will explain, starting with timeout.rb. You see, timeout.rb allows you to specify that a given block of code should only run for a certain amount of time. If it runs longer, an error is raised. If it completes before the timeout, all is well. Sounds innocuous enough, right? Well, ...