# Adventures in Production Rails Debugging

DevFeed: [Adventures in Production Rails Debugging](<https://devfeed.tech/articles/adventures-in-production-rails-debugging-1292.md>)

Original publisher: [Read original article](<https://shopify.engineering/adventures-in-production-rails-debugging>)

Author: Scott Francis

Published: 2016-03-08T15:43:00Z

Content type: article

Language: en

Sources: [Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering.md>), [Shopify Engineering - Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering-shopify-engineering.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [ASCII](<https://devfeed.tech/topics/ascii.md>), [Shopify](<https://devfeed.tech/topics/shopify.md>)

Tags: [ascii](<https://devfeed.tech/tags/ascii.md>), [breakpoint](<https://devfeed.tech/tags/breakpoint.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [gdb](<https://devfeed.tech/tags/gdb.md>), [instrumentation](<https://devfeed.tech/tags/instrumentation.md>), [process](<https://devfeed.tech/tags/process.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>)

## AI overview

This Shopify Engineering article explains how to debug production Rails problems with gdb. It describes retrieving a Ruby call stack, inspecting environment variables, and investigating a warning caused by matching an ASCII regular expression against a UTF-8 string. The approach attaches to an idle Unicorn worker, sets a breakpoint, resumes the process, dumps a core file, and examines the problem out of band without disrupting the customer request.

## Source excerpt

5 minute read At Shopify we frequently need to debug production Rails problems. Adding extra debugging code takes time to write and deploy, so we've learned how to use tools like gdb and rbtrace to quickly track down these issues. In this post, we'll explain how to use gdb to retrieve a Ruby call stack, inspect environment variables, and debug a really odd warning message in production. We recently ran into an issue where we were seeing a large number of similar warning messages spamming our log files: /artifacts/ruby/2.1.0/gems/rack-1.6.4/lib/rack/utils.rb:92: warning: regexp match /.../n against to UTF-8 string This means we are trying to match an ASCII regular expression on a UTF-8 source string.