So a huge feature missed from the JVM is the ability to send SIGQUIT
(ctrl-break) and get a list of running threads. This feature is a
killer feature for tracking down hung processes, as it will allow you
to see where threads are hung up.
I’ve written a small C extension for Ruby that will send a list of
threads and their current file/line number executing to STDERR upon
receiving a SIGQUIT. Simply install the gem and require ‘thread-dump’,
and a trap will be registered with SIGQUIT within that process. (So,
if you’re fork’ing stuff, you need to do the require within the fork,
Still waiting on the rubyforge project, if you really need this ASAP
(as we did), I’ve put it up at google pages:
This helped us track down a nasty bug that was occuring due to the
lack of a timeout in Net::HTTP during SSL connect, which still seems
to be busted in ruby trunk.
The extension is still very primitive, I was unable to decipher the
Ruby C necessary to unwind the full stack frame for a thread that is
not currently executing, but fortunately was able to at least get the
bottom of the stack using the RNode held by the *thread. Help with
this feature would be greatly appreciated!
It should be up at thread-dump.rubyforge.org sooner or later.