Troubleshooting Ruby Processes - Leveraging System Tools When the Usual Ruby Tricks Stop Working
Addison-Wesley Professional Ruby Series
“Philippe’s book yields knowledge of powerful UNIX tools for debugging ruby processes. It is a must read.”Wayne E. Seguin, Engine Yard
This short cut introduces key system diagnostic tools to Ruby developers creating and deploying web applications. When programmers develop a Ruby application they commonly experience complex problems which require some understanding of the underlying operating system to be solved. Difficult to diagnose, these problems can make the difference between a project’s failure or success.
“Troubleshooting Ruby Processes does a wonderful job of explaining the details of how to use tools like lsof, strace and gdb, while maintaining a good focus on applying them to ruby and mongrel processes.”Tammer Saleh, Thoughtbot
This short cut demonstrates how to leverage system tools available on Mac OS X, Linux, Solaris, BSD or any other Unix flavor. You will learn how to leverage the raw power of tools such as lsof, strace or gdb to resolve problems that are difficult to diagnose with the standard Ruby development tools. You will also find concrete examples that illustrate how these tools solve real-life problems in Ruby development. This expertise will prove especially relevant during the deployment phase of your application. In this way, should your production Mongrel cluster freeze and stop serving HTTP requests, it will not take you 2 days to figure out why!
“It’s a useful book to read to learn why problems occur and which tools to solve the problem”Peter Cooper, Ruby Inside
If you enjoy the book, consider recommending me on Working With Rails. 
Buy the PDF on Informit or read it online with Safari.
Tools & Downloads
A collection of advanced troubleshooting tools you can use for Ruby:
Download the gdb macros described in the book.
Ruby VM patch to get caller_for_all_threads (M.R.I 1.8.6).
Native Gem providing reliable timeouts for Ruby (M.R.I 1.8).
Out-of-the-box Ruby on Rails instrumentation for DTrace.
Supplementory Articles
Some parts of this book assumes a basic UNIX knowledge as well as an overall understanding of modern operating systems. Newcomers to Mac OS X and the UNIX platform might benefit from some introductory material in this area, which is why I wrote the articles below. In fact I even bet that some long time UNIX users will find the content interesting: Personally I had a lot of fun writing these articles, especially for ”In UNIX Everything is a File”.

-
“Introduction to UNIX Signals and System Calls” is a gentle introduction to UNIX signals and system calls in case you need to refresh your memory or are not familiar with operating system design.
-
”In UNIX Everything is a File” provides some background on the fundamental metaphor of the UNIX operating system: The file constitutes a unified paradigm for accessing system resources.
- ”Effortless Thread Dump for Ruby” describes how you can patch to MRI 1.8.6 to get insight on any problem happening in Ruby. Just send a
QUITsignal to your Ruby VM and it will dump a stack trace for all the threads.

More coming!
I plan to update this web page with new material, cool tricks, best practices and community-contributed content. Stay tuned for more goodies and subscribe to the RSS or Atom feed.
Participate!
The art of troubleshooting Ruby processes is evolving quickly as the tools, the platform, and the experience mature. I am especially interested in your feedback on this topic. If you have any comments, suggestions, ideas, or tricks, please contact me so that we may further develop our collective knowledge. Come visit this page from time to time or just subscribe to the feed.

