Phusion white papers Phusion overview

Phusion Blog

Phusion Passenger 2.2.3 released – Bug Fix Edition

By Hongli Lai on June 17th, 2009

Phusion Passenger is an Apache and Nginx module for deploying Ruby on Rails web applications, and is mainly focused on ease of use and stability.

Announcing the “Bug Fix Edition”

Phusion Passenger has gained a lot of features lately, with the most prominent one being Nginx support. A lot of software become more bloated and more buggy over time, and their documentation become outdated. But we at Phusion strive to maintain a high level of quality. Thus, after the release of version 2.2.2, we decided to focus our efforts on polishing Phusion Passenger, which means:

  • Fixing as many outstanding bugs as possible, instead of introducing new major features.
  • When introducing new features, only introduce those for which there is a lot of demand and that do not affect stability too much.
  • Spending time on improving the documentation and keeping it up-to-date.
  • Improving error messages. Nothing is more frustrating than seeing that something went wrong, but not knowing that it exactly is.
  • Improving overall usability. Even though Phusion Passenger is server software and our user base is generally knowledgeable, we still think usability is important and we take it very seriously.

The result is version 2.2.3, which we informally call the “Bug Fix Edition”. Over the course of two months, we’ve committed more than 80 change sets. Approximately 7500 lines of code has been changed, and approximately 45 bugs have been fixed.

The summary of changes – which we’ve attempted to sort based on importance – are as follows. Unless marked otherwise, a change affects both Apache and Nginx.

Fixed sub-URI deployments for Rails 2.2+ apps
Sub-URI deployments has been broken on Rails 2.2+ apps for some time now. This is because Rails 2.2 changed the way the sub-URI deployments are handled for the sake of thread-safety. Sub-URI deployments on Rails 2.2 was no longer automatic and required one to change config.action_controller.relative_url_root in environment.rb. We’ve fixed this issue so that sub-URI deployment is once again automatic, without the need to set config.action_controller.relative_url_root manually. Fixes issue #169.
Fixed many compilation problems
The most prominent fix affects GCC 4.4 support. GCC is included in e.g. Fedora 11.
Compilation problems on OpenBSD, Solaris and OpenSolaris have also been fixed.
On OpenBSD, please note however that Phusion Passenger for Apache doesn’t work because of severe limitations in their pthreads implementation. The Nginx version works fine, so we recommend OpenBSD users to use Phusion Passenger for Nginx.
[Apache] Ability to pass environment variables via mod_env directives
If you want to pass environment variables to your applications, then you no longer need to do that via a Ruby wrapper script. Instead, you can just use mod_env directives, just like you intuitively would do:

<VirtualHost *:80>
   DocumentRoot /rails_apps/foo/public
   SetEnv PATH /usr/bin:/opt/ffmpeg/bin:/usr/local/bin

You can then access PATH in your application via ENV['PATH'].

Please note however that:

  • Environment variables are no longer passed through request headers. Previously you would be able to access the PATH value set by mod_env from a controller through request.env['PATH']. You can no longer do that now. Access ENV['PATH'] instead.
  • Environment variables are set after the Ruby interpreter is started, so you cannot set environment variables that are supposed to affect the Ruby interpreter itself. For example, the Ruby Enterprise Edition garbage collector tuning environment variables cannot be set through SetEnv directives. You still need to use a wrapper script for that.
[Apache] Fixed many unintended “Broken pipe” I/O problems
Some people experience a lot of “Broken pipe” I/O problems. This manifests itself on the browsers’ side as a prematurely terminated connection, i.e. the web server closes the connection before the page was fully loaded. We’ve worked extensively with one of our clients to solve this problem, and it was determined that this problem was for a large part caused by bugs in Apache’s I/O routines. We’ve fixed many of these “Broken pipe” problems by rewriting our code to use our own I/O routines instead of Apache’s.

If you’re still experiencing “Broken pipe” problems, then please consider switching to Nginx. Some of these “Broken pipe” problems seem to be caused by bugs in the Apache I/O routines which we are not able to override. It has been reported that 99% of the broken pipe problems went away after switching to Nginx.

Please also note that such “Broken pipe” problems may also be caused by other malfunctioning parts, such as broken routers.

[Nginx] Fixed several Nginx restarting-related bugs
These bugs could cause Phusion Passenger to malfunction after restarting Nginx gracefully with SIGHUP.
[Nginx] If passenger_root is not set, then Nginx will disable Phusion Passenger instead of exiting with an error
This makes it possible to distribute Phusion Passenger-enabled Nginx binaries to users who may not necessarily use Phusion Passenger. Fixes issue #286.
[Nginx] Fixed page cache file serving.
The content type wasn’t being set correctly, so that all page cache files were served as application/octet-stream. Fixes issue #261.
[Nginx] Fixed Nginx 0.7 compatibility
Page caching was broken on Nginx 0.7, for a reason other than the aforementioned.
[Nginx] STDOUT and STDERR are now correctly redirected to the Nginx log file; fixes “Input/Output Error” (EIO) problems
Before, STDOUT and STDERR wouldn’t always be redirected to the Nginx log file, depending on the way Nginx is started. If it didn’t happen, and STDOUT and STDERR still point to the console, and the user disconnects from the console, then all data written to STDOUT and STDERR is silently discarded on most operating systems. This is obviously undesirable because it would mean that error messages are silently discarded. But on Linux, writing to a disconnected console like this would generate “Input/Output Error” (EIO) messages. Fixes issue #307.
Fixed displaying of information written to STDERR by the application during startup.
Such information was being silently discarded, which caused a lot of confusion for some people.
Fixed restarting of the ApplicationSpawner server
If the ApplicationSpawner server was still running, but no Rails processes are running, then touching restart.txt would not result in the ApplicationSpawner being restarted. Fixes issue #300.
[Apache] Improved file upload error messages
Apache’s file upload I/O routines only tell us that something went wrong, but not what went wrong. We rewrote these routines with our own so that we can now tell the administrator the reason why a file upload failed.
[Apache] Improved I/O error messages
Phusion Passenger will now try harder to come up with a descriptive error message, as well as with some suggestions.
Log application startup errors to the web server log file
Before, application startup errors are only shown in the web browser. This poses a problem for people who replace the default Phusion Passenger error page templates: there would be no way to see the error. Fixes issue #210.
Fixed file upload support on Ruby 1.9
It wasn’t setting encoding properties properly.
[Nginx] Fixed some client connection problems by increasing the HelperServer’s connection backlog to the maximum possible value
If you see errors in your Nginx log file along the lines of “helper_server.sock: connect(): Resource temporarily unavailable” or “helper_server.sock: connect(): In progress”, then this probably indicates that the HelperServer’s connection backlog is full, in which case this fix might help.

If it doesn’t help, then you should also increase:

  • your system’s default maximum allowable backlog size. On Linux, you can check the current size with the following command:
    cat /proc/sys/net/core/somaxconn

    Nginx’s backlog size defaults to 511, but Linux’s maximum allowable backlog size defaults to 128. By writing ‘512’ to this file you can increase it.

  • your system’s default TCP receive buffer size. Please consult for information.
[Apache] TMPDIR is no longer set automatically
This fixes compatibility with PHP sessions, among other things.
[Nginx] Fixed WSGI support
It was looking for in the wrong directory.
passenger-status no longer shows backtraces by default
We used to show backtraces for debugging purposes, but many people confused these with errors, so now we hide the backtraces in passenger-status by default.
Various Rack specification compliance fixes.
Fixed a potential security problem in the random number generator
The random number generator is now reseeded in every process that’s spawned off by Phusion Passenger, so that the child processes do not generate the same random number sequences. Fixes issue #118.
[Apache] New configuration option: PassengerUploadBufferDir
This option allows you to configure the directory in which upload buffer files are stored, in case you do not want them to be stored in /tmp for whatever reason.
[Apache] Fixed “Socket not connection” (ECONN) errors
These errors are harmless so we silently ignore them now. Fixes issue #158
[Nginx] passenger-install-nginx-module: do not crash if unable to write to the Passenger root directory
It will now report a proper error message, as it should. Fixes issue #287.
[Nginx] passenger-install-nginx-module now downloads Nginx 0.6.37 by default
We don’t download 0.7 by default yet until we’ve confirmed that it’s stable.
Improved test coverage
We’ve spent some time to increase the test coverage in our code base in order to maintain the current level of quality.
Improved documentation
The following chapters in the Apache users guide have been updated or added:

How do I upgrade to 2.2.3?

Via a gem

Please install it with the following command:

gem install passenger

Next, run:


Or, if you’re an Nginx user:


Please don’t forget to copy & paste the Apache/Nginx config snippet that the installer gives you.

(Note that RubyForge might still be distributing the files to their mirrors, so you might temporarily get “404 Not Found” errors until all mirrors are updated.)

Via a native Linux package

John Leach from Brightbox has kindly provided an Ubuntu 8.04 package for Phusion Passenger. The package is available from the Brightbox repository which you can find at:

Add the following line to the Third Party Software Sources:

deb hardy main

(The simplest way to do that is to create a file in /etc/apt/sources.list.d/ containing the deb instruction, and then run ‘apt-get update’).

Once you’ve done this then you can install Phusion Passenger by running:

sudo apt-get install libapache2-mod-passenger


sudo apt-get install nginx-brightbox

(Note that John is currently packaging 2.2.3, so it might take a while before this release shows up in the apt repository.)


Phusion Passenger is provided to the community for free. We’ve put a lot of effort into this release. If you like Phusion Passenger, please consider sending us a donation. Thank you!

Hongli Lai Ninh Bui