Last active
August 6, 2016 16:50
-
-
Save kirs/712db4a6c0f338c18f7257b1d37068b4 to your computer and use it in GitHub Desktop.
Debug stuck unicorn threads
This file contains hidden or 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
after_fork do |server, worker| | |
Signal.trap('USR2') do | |
pid = Process.pid | |
puts "[#{pid}] Received USR2 at #{Time.now}. Dumping threads:" | |
Thread.list.each do |t| | |
trace = t.backtrace.join("\n[#{pid}] ") | |
puts "[#{pid}] #{trace}" | |
puts "[#{pid}] ---" | |
end | |
puts "[#{pid}] -------------------" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: http://varaneckas.com/blog/ruby-tracing-threads-unicorn/