Skip to content

Instantly share code, notes, and snippets.

@sj26
Created September 28, 2016 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sj26/1b19e2a0d58364e0067ab047d7281b42 to your computer and use it in GitHub Desktop.
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!
# 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