[PATCH] always process short preread body

John Fremlin jfremlin at cerego.co.jp
Thu Sep 25 16:25:08 MSD 2008

Thanks for answering

On Thu, 25 Sep 2008 18:56:16 +0900 Maxim Dounin <mdounin at mdounin.ru>
> On Thu, Sep 25, 2008 at 12:56:02AM +0100, John Fremlin wrote:
> >John Fremlin <john at fremlin.org> writes:
> >> We are using nginx/0.6.22 on Ubuntu hardy or intrepid, i386 or
> >> amd64. nginx is in front of a mongrels rails app.
> >>
> >> For one particular request, the response from the rails app is
> >> received by nginx, with the header and the body together in one
> >> readv(2). However it waits for 60s and then sends out only the
> >> header to the client, without the body, but with the correct
> >> Content-Length, as if the body were included!
> >>
> >> This happens every time for this request but POSTs to other URLs
> >> resulting in 302 work fine.

>   From strace in your message, it looks like the real problems are:
> 1. Backend, which hasn't closed connection after sending reply.

Yes, the backend does not close.
> 2. The fact that nginx waits for connection close before it
> realizes that request was completed, even if got 'Content-Length'
> header and appropriate number of body bytes.

And 3. nginx never forwards the body of the message after the time out,
(even though it has read it) sending only the header
with content-length!

> The 1 isn't really related to nginx.  The 2 should be fixed, but
> a) the patch doesn't do it (or at least doesn't do it properly)

It does fix the problem . . . Sorry for destroying buffering!

> and b) it only matters with backend bug as in 1.
> Could you please confirm that backend doesn't close connection?

Yes, the backend does not close the connection.

More information about the nginx mailing list