Posted about 1 month ago. Visible to the public. Linked content. Auto-destruct in 12 days

Updated: Inspecting a live Ruby process

Updated the gdb-inspect card with instructions for Ruby 2.4+.

Ruby 2.4+

TL;DR live inspection:

Copy
# First, find out the PID of your Ruby process (e.g. passenger-status) $ gdb PID (gdb) generate-core-file # generate core.PID file for later inspection (gdb) t a a bt # thread apply all backtrace (gdb) call (void) close(1) # close the existing file descriptors for stdout (gdb) call (void) close(2) # close the existing file descriptors for stderr (gdb) shell tty # we need to figure out the device name for the current TTY: /dev/pts/X # X is an integer, adjust for your shell (gdb) call (int) open("/dev/pts/X", 2, 0) # attach stdout to current TTY (gdb) call (int) open("/dev/pts/X", 2, 0) # attach stderr to current TTY call (void) rb_backtrace() # print the Ruby backtrace to the current shell (gdb) detach # detach from the Ruby process (PID) (gdb) quit # exit gdb

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Michael Leimstädtner
Last edit:
about 1 month ago
by Michael Leimstädtner
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Michael Leimstädtner to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more