Created
September 7, 2012 15:18
-
-
Save anselm-helbig/3667085 to your computer and use it in GitHub Desktop.
Get a backtrace from a hanging ruby process
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
| Say you have one process in an endless loop. You know its process id: | |
| ruby -e 'puts $$; loop {}' | |
| => 30360, hangs | |
| You can attach to this process with gdb now and make it print a backtrace to stdout: | |
| gdb -p 30360 | |
| GNU gdb (GDB) 7.5 | |
| Copyright (C) 2012 Free Software Foundation, Inc. | |
| [...] | |
| (gdb) call rb_backtrace() | |
| (gdb) detach | |
| Detaching from program: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby, process 30360 | |
| (gdb) quit | |
| Might come in handy from time to time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment