Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working (Digital Short Cut)
- By Philippe Hanrigou
- Published Oct 29, 2007 by Addison-Wesley Professional. Part of the Addison-Wesley Professional Ruby Series series.
- Copyright 2008
- Dimensions: 10-1/2x7-3/4
- Pages: 58
- Edition: 1st
- eBook (Watermarked)
- ISBN-10: 0-321-54468-4
- ISBN-13: 978-0-321-54468-1
Register your product to gain access to bonus material or receive a coupon.
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. 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!
Table of Contents
What This Shortcut Covers
Ruby Troubleshooting: The Usual Suspects
raise, puts and debug()
irb or script/console
Writing a Test
Debugger and Breakpointer
What is It?
Typical Usage Scenarios
Combining Multiple Selections
Concrete Examples Using lsof to Troubleshoot a Problem with a Ruby Process
Checking that a Mongrel Cluster is Up and Listening on the Right Ports
Checking that You Are Using a Native Database Driver
Detecting Connection Leaks
Exploring Other Tricks
Exploring Other lsof Options
What is lsof Good For?
What is It?
Interpreting strace Output
How Do I Find Out About a Specific System Call?
What is strace Good For?
Some Concrete Examples
Where Did That Library Come From? Peeking at the Load Path
Other Interesting strace Options
Tracing Child Processes
Basic System Level Profiling
Mac OS X
Solaris and OpenSolaris
The Basics: Attaching to a Running Process and Getting the C-Level Backtrace
Raising a Ruby Exception from gdb to Get the Ruby Stack Trace
Easy Access to your gdb Tricks: Define Macros in .gdbinit
Pushing the Envelope: Evaluate Arbitrary Ruby Code from gdb
A Ruby Interpreter Within gdb
Using gdb Inline Documentation
Learning about Ruby Interpreter Internals
What is gdb Good For?
A Classic Gotcha: Unattachable Processes
About the Author
eBook (Watermarked) $12.99
Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.