[katello-devel] ruby thread dump

Mike McCune mmccune at redhat.com
Mon Jul 15 20:31:30 UTC 2013


Been wanting to be able to get a thread dump from Ruby for a while, 
similar to Java's 'kill -3'

jweiss pointed me at:

http://www.mikeperham.com/2012/06/02/debugging-with-thread-dumps/

which prompted:

https://github.com/Katello/katello/pull/2631

so, now if you have a ruby process in katello that you want to dump a 
thread-dump to see what it is doing do a:

# kill -TTIN <thin PID>

this gets you:

/var/log/katello/thin-log.5000.log

Starting thread dump for current Ruby process
=============================================

Thread TID-10330100
/usr/share/katello/config/initializers/xray.rb:9:in `block (2 levels) in 
<top (required)>'
/usr/share/katello/config/initializers/xray.rb:7:in `each'
/usr/share/katello/config/initializers/xray.rb:7:in `block in <top 
(required)>'
/opt/rh/ruby193/root/usr/share/gems/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in 
`call'
/opt/rh/ruby193/root/usr/share/gems/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in 
`run_machine'
/opt/rh/ruby193/root/usr/share/gems/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in 
`run'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in 
`start'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/server.rb:159:in 
`start'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/controllers/controller.rb:86:in 
`start'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/runner.rb:185:in 
`run_command'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/runner.rb:151:in 
`run!'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/bin/thin:6:in `<top 
(required)>'
/usr/share/katello/script/thin:26:in `load'
/usr/share/katello/script/thin:26:in `<main>'

it gets much more verbose if you are doing a bunch of stuff in the webui.

Mike
-- 
Mike McCune
mmccune AT redhat.com
Red Hat Engineering       | Portland, OR
Systems Management        | 650-254-4248




More information about the katello-devel mailing list