Rails 2.3.1+, Passenger, and Rack 1.0
Just an FYI for those of you running the latest stable Rails.
Rails 2.3.1+ depends on Rack 1.0. In 2.3.1, it only uses the vendor’d version of Rack 1.0 (which is located under action_controller/vendor). In 2.3.2, it can use a vendor’d version of Rack 1.0 if the gem isn’t installed in your system. Rails 2.3.3 depends on the Rack 1.0 gem and no longer contains vendor’d Rack. I haven’t found any reasons for why this has changed between point releases.
Either way, Rack 1.0 needs for the rack.input to be seekable. It calls rewind on said input. Passenger < 2.2.2 passed a UnixSocket as rack.input, which is not seekable. This will produce the following error in your Rails app:
/!\ FAILSAFE /!\ Thu Jul 23 10:57:14 -0700 2009
Status: 500 Internal Server Error
undefined method `rewind' for #<UNIXSocket:0x2add0f3f45a0>
So, to repeat. If you’re running Rails in 2.3.1+, you need Rack 1.0, which needs Passenger 2.2.2+. There have been various efforts by all sorts of software including Facebooker to work around this problem, but those seem to have sometimes caused more issues.
Incidentally, Dreamhost currently has Passenger 2.1.2 installed. *sigh*
References:
- http://blog.phusion.nl/2009/04/26/phusion-passenger-222-released/
- http://code.google.com/p/phusion-passenger/issues/detail?id=220
- http://groups.google.com/group/cloudkit/browse_thread/thread/f07b21320d0f6fe8
- http://groups.google.com/group/rack-devel/browse_thread/thread/4324acc264d9d6ed
- http://github.com/FooBarWidget/passenger/blob/423a88a1c5180f0209e91f14c05e7bde82818928/lib/phusion_passenger/rack/request_handler.rb#L70
- http://github.com/chneukirchen/rack/blob/7a55c98a30deea7fe198958d7c2770b087aa94b9/lib/rack/request.rb#L144
Oh, and I also learned that if there’s a particular commit in Github that you’d like to apply to your own source tree (say, for instance, the patch that removes vendor’d rack 1.0 from Rails which you’d like to reverse), you can simply add .patch onto the end of the URL and you’ll get the relevant patchfile. Github rocks!
UPDATE: Dreamhost has upgraded their versions of Passenger and Rack, and Rails 2.3.3 is now working. Thanks Dreamhost!





