Chris Zetter

The 'bad scan arg format' Bug

Last week I had upgraded the Engine Yard hosted app to run on ruby 1.9.3. As with most of engine yard config it was easy as pressing a button.

All was going well for the app except a cryptic “fatal: bad scan arg format: 1” exception in the logs coming from the Net::HTTP library.

Searching the Ruby source I found that the method rb_scan_args in class.c was causing the error. rb_scan_args is a helper method that can parse optional arguments.

It turns out that Engine Yard doesn’t restart Nginx on deploy, instance rebuild or even ruby upgrade. This means the Nginx & Passenger had been using ruby 1.9.2 with gems installed for ruby 1.9.3.

You can restart Nginx on Engine Yard by:

$ sudo /etc/init.d/nginx restart

Problem solved.

Read more by me, follow me on Mastodon or subscribe.