Exception IOError in Passenger RequestHandler (closed stream)

220 views
Skip to first unread message

P.A.

unread,
Nov 14, 2009, 10:22:55 AM11/14/09
to Phusion Passenger Discussions
Hi.

I've just started to use Phusion Passenger and I wrote a simple Rack
application. When I start it I get the error:

*** Exception IOError in Passenger RequestHandler (closed stream)
(process 4359):
from /home/<user_name>/.gem/gems/passenger-2.2.5/vendor/rack-1.0.0-
git/lib/rack/rewindable_input.rb:93:in `make_rewindable'
from /home/<user_name>/.gem/gems/passenger-2.2.5/vendor/rack-1.0.0-
git/lib/rack/rewindable_input.rb:26:in `read'
from /home/<user_name>/.gem/gems/passenger-2.2.5/vendor/rack-1.0.0-
git/lib/rack/request.rb:136:in `POST'
from /home/<user_name>/.gem/gems/passenger-2.2.5/vendor/rack-1.0.0-
git/lib/rack/request.rb:154:in `params'
from /home/<user_name>/development/nginx/test/controllers/
controller.rb:6:in `call'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/rack/request_handler.rb:95:in `process_request'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/rack/application_spawner.rb:118:in `run'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/rack/application_spawner.rb:69:in `block in
spawn_application'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/utils.rb:184:in `safe_fork'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/rack/application_spawner.rb:62:in
`spawn_application'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/rack/application_spawner.rb:45:in
`spawn_application'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/spawn_manager.rb:159:in `spawn_application'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:352:in `main_loop'
from /home/<user_name>/.gem/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:196:in `start_synchronously'
from /home/<user_name>/.gem/gems/passenger-2.2.5/bin/passenger-spawn-
server:61:in `<main>'
2009/11/14 17:50:33 [error] 3086#0: *12 upstream prematurely closed
connection while reading response header from upstream, client:
127.0.0.1, server: localhost, request: "GET /?name=value HTTP/1.1",
upstream: "passenger://unix:/tmp/passenger.3069/master/
helper_server.sock:", host: "localhost:1234"

Here it is the application itself:

# test/controllers/controller.rb
# encoding: utf-8
class Test
def call(env)
body = Rack::Request.new.params
# If I set body to an arbitrary string or to any other methods
# of the instance of Rack::Request, say get?, post?, env
# all works.
[200, {}, body.inspect]
end
end

# test/config.ru
require 'controllers/controller'
run Test.new

Here it is my environment:

Debian GNU/Linux 5.0.2;
Ruby 1.9.1;
Rack 1.0.0;
Phusion Passenger 2.2.5;
nginx 0.8.24.

Here it is the nginx configuration:

# <nginx_install_dir>/conf/nginx.conf

worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
passenger_root /home/<user_name>/.gem/gems/passenger-2.2.5;

server {
listen 1234;
server_name localhost;
root /home/<user_name>/development/nginx/test;
passenger_enabled on;
}
}

What is the reason of this bug? How can I fix it?

Thanks.

Hongli Lai

unread,
Nov 14, 2009, 2:31:43 PM11/14/09
to phusion-...@googlegroups.com
On Sat, Nov 14, 2009 at 4:22 PM, P.A. <sham...@hotmail.com> wrote:
>
> Hi.
>
> I've just started to use Phusion Passenger and I wrote a simple Rack
> application. When I start it I get the error:
>
> *** Exception IOError in Passenger RequestHandler (closed stream)
> (process 4359):

This is a bug in Ruby 1.9's tempfile library. It's been fixed in Ruby
SVN but there hasn't yet been a new release with the bug fix.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

P.A.

unread,
Nov 15, 2009, 8:54:46 AM11/15/09
to Phusion Passenger Discussions
I installed Ruby 1.9.2dev from SVN. The bug disappeared. Thanks for
help.

Dylansm

unread,
Nov 24, 2009, 1:58:09 PM11/24/09
to Phusion Passenger Discussions
Unfortunately, 1.9.2 Preview 1 still has this bug — wonder why the fix
wasn't merged.

Dylansm

unread,
Dec 8, 2009, 4:07:06 PM12/8/09
to Phusion Passenger Discussions
I just commented out line 140 of tempfile.rb and it plays nice with
Passenger again.

if File.exist?(@tmpname)
# closed? or close <------ comment out
File.unlink(@tmpname)
end
...
Reply all
Reply to author
Forward
0 new messages