FastCGI bug

I wrote some FastCGI scripts in Ruby and found the following bug: if the
size of the response is within certain range the script hangs and I get

FastCGI: comm with server “/home/httpd/fcgi/fcgibug.fcgi” aborted: idle
timeout (30 sec)

message in error_log. I created a simple script which takes one integer
as a parameter (which determines response size), so it is easy to
reproduce the bug:

FCGI_PURE_RUBY = true

require “fcgi”

FCGI.each {|request|
request.out.print( “\n\n” )
content = “a” * request.env[“QUERY_STRING”].to_i
request.out.puts( content )
request.finish()
}

The bug occures for the following ranges of parameters:
8191-24537
32767-???
49151-57309
65535-???

That is, when I want to access eg. http://localhost/fcgibug.fcgi?10000
the script hangs.

I was able to reproduce the bug every time I tried on 3 different
systems (each running Ruby 1.8.0 on Linux). The problem does not occur
when using FastCGI adaptor written in C, but there are other problems
with that one (eg. it hangs with the error message presented above but
much more randomly).

I tried to contact the maintainer of Ruby FastCGI adaptor, but he didn’t
answer. Maybe somebody has the same problem or has solved it?

···


Marek Janukowicz