June 9, 2010

Resolving an nginx and passenger problem

Was working on remote-configuring a server which runs a Ruby app using nginx and Phusion Passenger. Despite having everything configured properly (I was convinced it was, at least) I kept getting the following error on nginx startup:

Alert: could not send password to the passenger helper server: write() failed (32: Broken pipe)

nginx would refuse to start. It wouldn't even write anything to the error log. Argh.

To make a long story short, there were *two* reasons I was getting this error. Here they are, and here are the fixes.

Reason 1: Bad nginx.conf

In my nginx.conf, I was specifying the location of the passenger_root and of the passenger_ruby. In both cases, I had an incorrect path due to us having changed versions of ruby and the passenger gem - it had been updated, so its path changed.

Reason 2: Bad HelperServer

We (I) had installed nginx via the command passenger-install-nginx, included with the passenger gem. However, the version of passenger had been updated (from 2.2.5 to 2.2.14, as if it matters) and we (I) had not re-run that install process. I originally didn't think it mattered. However, apparently (and I'm not positive of this) there is a HelperServer that is compiled at install time which points to a particular passenger instance, so if you upgrade passenger, you need to rerun the passenger-install-nginx command. It won't stomp on any configs or anything.

Anyhow, after fixing those problems, whee, nginx and passenger started fine. I hope this helps someone, because I was looking for exactly this post frantically during the Google phase of debugging, and didn't find it. I found pieces of info, but not all of it. Posted by jbz at June 9, 2010 1:10 PM | TrackBack

Comments

I was having this very error and your solution worked for me!

Thanks for taking the time to write it up.

Posted by: Seth at October 25, 2010 3:54 PM

Thanks! you might also note that this also is caused when you upgrade passenger and you would have to re-compile nginx with the path to the gem In my case it is below:
./configure --add-module=/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/nginx

Posted by: Ben at August 10, 2010 1:32 AM
Post a comment









Remember personal info?