Created
October 19, 2018 18:41
-
-
Save YanhaoYang/8ddbf16ea47839e53665a28bda814fc2 to your computer and use it in GitHub Desktop.
Print the call stacks in a multithread application, say puma, to know which threads are blocked
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
before_fork do | |
trap 'TTIN' do | |
Thread.list.each do |thread| | |
puts "\nThread TID-#{thread.object_id.to_s(36)}" | |
puts thread.backtrace.join("\n") | |
puts "\n" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment