(bug?)Timeout when proxy-pass 0 byte file

Maxim Dounin mdounin at mdounin.ru
Wed Sep 30 22:48:27 MSD 2009


Hello!

On Wed, Sep 30, 2009 at 12:42:52PM +0400, Maxim Dounin wrote:

> On Wed, Sep 30, 2009 at 11:26:59AM +0800, tOmasEn wrote:

[...]

> > the initiall request when there isn't and cache, everything is ok. the
> > following request to same url will wait until timeout.
> 
> Ok, so the problem is cache.  Thanks, I'm able to reproduce it 
> here.  I'll take a look later today how to fix it.

Patch.

Maxim Dounin

> 
> Maxim Dounin
> 
> [...]
> 
> > 
> > On Tue, Sep 29, 2009 at 10:48 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > 
> > > Hello!
> > >
> > > On Tue, Sep 29, 2009 at 10:08:51PM +0800, tOmasEn wrote:
> > >
> > > > I been expirencing very slow page load when use nginx as frontend(with
> > > > proxy_pass) for a while.
> > > >
> > > > After some test and debug, i found that it always timeout on response
> > > > of 0 byte file.
> > > >
> > > > So i think there might be a bug when nginx running on proxy mode and
> > > > serving 0 byte files. The frontend will consider there should be more
> > > > data and wait until timeout or something like this.
> > >
> > > Could you please provide nginx -V output and debug log?
> > >
> > > Maxim Dounin
> > >
> > > >
> > > > Btw. Nginx is great. Thanks
> > > >
> > > > tomasen
> > > >
> > > > --
> > > > 从我的移动设备发送
> > > >
> > >
> > >
> 
-------------- next part --------------
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1254336299 -14400
# Node ID 3a18992ceed641398ac911ad7230924ba2f28929
# Parent  7688992d2abb6759b0a91c4b0cf86802d27cbc4a
Cache: send correct special buffer for empty responses.

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -798,7 +798,7 @@ ngx_http_cache_send(ngx_http_request_t *
 
     size = c->length - c->body_start;
     if (size == 0) {
-        return rc;
+        return ngx_http_send_special(r, NGX_HTTP_LAST);
     }
 
     b->file_pos = c->body_start;


More information about the nginx mailing list