O'Reilly logo

Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working by Philippe Hanrigou

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Section #2. Ruby Troubleshooting: The Usual Suspects

Even though strace, lsof, and friends are powerful tools, most of the time you should not start with them. This section is a brief recap of the techniques typically used to troubleshoot a problem with a Ruby process.

raise, puts, and debug()

Without a doubt, the most popular way to investigate an unexpected behavior in a Ruby program is to add a raise some_object.inspect statement or a puts some_object.inspect statement in the code and rerun the same test or use case. Quick and dirty...and terribly efficient (especially the raise version: It is easy to spot, and you won’t forget to remove it).

Rails has a variant for HTML rendering in a view: the debug() function. This function outputs the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required