Created
September 28, 2016 04:15
-
-
Save sj26/1b19e2a0d58364e0067ab047d7281b42 to your computer and use it in GitHub Desktop.
Send a SIGINFO to a rails process, get a backtrace of every thread!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Send a process a SIGINFO like `kill -INFO <pid>` and it will print the | |
# current backtrace of all threads. | |
Signal.trap(29) do | |
puts "Thread dump:" | |
Thread.list.each do |thread| | |
puts thread.inspect.indent(2) | |
puts thread.backtrace.join("\n").indent(4) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment