Unicorn hangs on POST request

Tom Pesman tom at tnux.net
Sun Mar 10 16:22:35 UTC 2013


> Tom Pesman <tom at tnux.net> wrote:
>> Hello,
>>
>> I'm trying to fix a problem I'm experiencing with my Rails
>> application hosted at Heroku. I've one POST request which hangs and
>> with the help of a customized rack-timeout gem
>> (https://github.com/tompesman/rack-timeout) I managed to get a
>> stacktrace: https://gist.github.com/tompesman/7b13e02d349aacc720e0
>>
>> How can I debug this further to get to the bottom of this and is
>> this a rack or a unicorn problem?
>
> It's a client or proxy problem.
>
> The request was too large to be transferred within your configured
> timeout, or the client or proxy layer was too slow at transferring the
> POST to unicorn, or the host running unicorn was too overloaded/slow
> to buffer the request.
>
> Factors:
> 1) Disk/filesystem/memory speed on the (client|proxy) talking to unicorn
> 2) Disk/filesystem/memory speed on the host running unicorn.
> 3) The network link between the (client|proxy) <-> unicorn.
>
> I don't know about Heroku, but nginx will fully buffer the request body
> before sending to unicorn, so all 3 factors are within your control.
>
> Does Heroku limit (or allow limiting of) the size of request bodies?
>
> Maybe a bad client sent a gigantic request.  nginx limits request bodies
> to 1M by default (client_max_body_size config directive).
>
> [1] unicorn buffers request bodies to TMPDIR via TeeInput
>

I agree with you if the POST request has a file to upload, but the
requests we're dealing with do not upload a file and are actually quite
small.

Example request (this is not a request that has failed, these are hard to
catch):
https://gist.github.com/tompesman/2e8ca417cdecb7580c9f

I've also made a dump of the env variable in the customized rack-timeout
middleware. This is a request that has failed.
https://gist.github.com/tompesman/1217d4f02aa33efcd873

Can I modify the my customized rack-timeout gem to get more information to
debug this problem?
https://github.com/tompesman/rack-timeout/blob/master/lib/rack/timeout.rb

Cheers,

-- 
Tom Pesman




More information about the mongrel-unicorn mailing list