[Mongrel] clients hang on large PUTs to Mongrel::HttpHandler-based web service

Zed A. Shaw zedshaw at zedshaw.com
Wed Jun 4 16:18:29 EDT 2008

On Wed, 4 Jun 2008 00:35:16 -0400
"Randy Fischer" <rf at ufl.edu> wrote:

> On Tue, Jun 3, 2008 at 8:16 PM, Zed A. Shaw <zedshaw at zedshaw.com> wrote:

> Naw, it's the content length in the body of a PUT,  I ask since I saw
>    int content_length

Well, looking in the source I can't see where that's actually used to
store the Content-Length header value.  It actually seems to be dead.
Instead you have this line in http_request.rb:

content_length = @params[Const::CONTENT_LENGTH].to_i

Now, that means it relies on Ruby's base integer type to store the
content length:


""A Fixnum holds Integer values that can be represented in a native
machine word (minus 1 bit). If any operation on a Fixnum exceeds this
range, the value is automatically converted to a Bignum.""

Which is kind of vague, but there's a good chance it's implemented as a
32-bit signed integer giving you a problem with a 4G content size.  It
should be converted to a Bignum on overflow, but a quick test would be
to check the class of the content_length right after this line to see
what it's getting.

Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/

More information about the Mongrel-users mailing list