Passenger 5.0.27: fixes, fixes, improvements

Version 5.0.27 of the Phusion Passenger application server for Ruby, Node.js, Meteor and Python has been released. It has some interesting fixes for issues like "on_event" errors, a buffering memory leak and OOM inheritance. Improvements include support for building on Debian GNU/kFreeBSD.

If you hadn't already, be sure to check out the many major improvements that the 5.x series of Passenger introduces. And please be aware that you can enjoy enterprise features and sponsor the open source development directly by buying Phusion Passenger Enterprise.

"on_event" errors fixed (rails server)

In 5.0.25 we added support for adding Passenger to the Gemfile, and integrated it with the rails server command. However, having Passenger in the Gemfile could also cause early dependencies on the Passenger API (before it was fully loaded), and result in the error: undefined method 'on_event' for PhusionPassenger:Module (NoMethodError) (GH-1768, GH-1783).

We've fixed this by adding forward definitions for the API.

Update: shortly after release we discovered this fix is missing 1 commit :(. This will be part of the next release.

Disk buffering memory leak fixed

Passenger has a 100 KB internal memory buffer for handling request and response bodies. To support larger bodies as well it switches to a disk buffer, but internal testing revealed a memory leak in the buffer cleanup afterwards. This results in increasing Passenger Core memory use and could be the root cause of GH-1728.

The leak has been fixed, and no further leaks were detected with Valgrind.

OOM inheritance fixed

The Passenger Core and application processes were seen to have an OOM score equivalent to unkillable (GH-1631) whenever passenger_user_switching was set to off (default: on). This means that the Linux Out of Memory Killer would not be able to touch application processes getting severely out of hand memory-wise.

The unkillable OOM score is meant to be applied only to the Passenger Watchdog, which uses very minimal resources and must not exit before all other Passenger-related processes are finished or killed. The Watchdog normally resets the unkillable OOM score that the Core automatically inherits from it, but this was denied by the OS in some code paths.

We've found a different way of applying the OOM score that solves the issue in our tests.

Native support compilation fixed

A small fix in 5.0.26 resulted in a regression that caused compilation of the native_support library to fail when Passenger was installed through Debian or RPM packages (GH-1778).

This wasn't an issue in itself because the library is optional (it provides a small speed boost) and Passenger has non-native backup code that allows it to function normally, but the backup code did have an encoding problem (GH-1763). If an application outputs an encoding that doesn't mix with UTF-8 (like UTF-16), the result would be a 0-byte response body.

Both issues have been confirmed to be fixed.

Various bug fixes

  • Fixes incomplete libuv upgrade: some build files were not autoregenerated during the upgrade from 1.5.0 to 1.8.0 in the previous release.
  • Fixes crash if an application spawn fails and a non-UTF8 character appears in the spawn output. Closes GH-1601.
  • [Union Station] Fixes a crash that occurs if all of the following conditions are met: 1) Union Station support is enabled, 2) the client sent at least one header containing the empty string, 3) the application responds with a 4xx or 5xx status. Closes GH-1776.

Various improvements

  • Warnings about 502 responses that are caused by applications aborting their output while the client is no longer connected (e.g. due to half-close event, reported since 5.0.26) are now reduced to debug level.
  • Supports Debian GNU/kFreeBSD build. Based on contribution by stevenc99.
  • Switches a number of places in the Passenger Core over to using the monotonic clock instead of the wallclock for robustness against clock time-stepping.
  • Slightly improves out-of-memory detection in some subroutines.

Installing 5.0.27

Please see the installation guide.

Upgrading to 5.0.27

We strongly advise staying up to date with the latest version.

See also the upgrade notes below!


OS X

Debian

Ubuntu

Heroku

Red Hat

CentOS

Ruby gem

Tarball

Docker

If you are upgrading from 4.x, please read the 5.0 upgrade notes to learn about potential upgrade caveats.

Special notes about capistrano-passenger

If you are using Capistrano and [capistrano-passenger], then it may fail with this error:

SSHKit::Runner::ExecuteError: Exception while executing as user@99.99.99.99: undefined method `[]' for nil:NilClass

NoMethodError: undefined method `[]' for nil:NilClass

Tasks: TOP => passenger:restart

This is due to an incompatibility in capistrano-passenger with Passenger 5.0.22 and later. Please upgrade capistrano-passenger to 0.2.0 or later.