In memory subrequest hang if backend return 500

Maxim Dounin mdounin at mdounin.ru
Wed Mar 21 10:45:54 UTC 2012


Hello!

On Wed, Mar 21, 2012 at 06:13:37PM +0900, 최영석 wrote:

> Hi, Maxim.
> 
> Can you please explain how this part could make problems for keepalive
> connections of backends?

Consider response with status 500, keepalive used and 
Content-Length set: this code will drop part of the response, and 
it won't be counted by u->length, thus causing nginx to wait for 
data it already got (and discarded).

Maxim Dounin

> 
> Thank you!
> 
> 2012/3/21 Maxim Dounin <mdounin at mdounin.ru>
> 
> > Hello!
> >
> > On Wed, Mar 21, 2012 at 10:53:45AM +0800, Abioy Sun wrote:
> >
> > > Hi All,
> > >
> > > In the file ngx_http_upstream.c I found some code like this:
> > >
> > > 1618     if (u->headers_in.status_n > NGX_HTTP_SPECIAL_RESPONSE) {
> > > 1619
> > > 1620         if (r->subrequest_in_memory) {
> > > 1621             u->buffer.last = u->buffer.pos;
> > > 1622         }
> > >
> > > that means, if the status backend return if greater than 300, the first
> > > part of the body would be abandoned.  Will this cause the issue that the
> > > main request won't be woken again and keep sleeping until timeout? Or
> > did I
> > > misunderstand anything?
> >
> > Do you use keepalive connections to backends?
> >
> > As far as I see, this may indeed cause problems with keepalive
> > connections, though should be ok in non-keepalive case.
> >
> > Maxim Dounin
> >
> > _______________________________________________
> > nginx-devel mailing list
> > nginx-devel at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx-devel
> >

> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel



More information about the nginx-devel mailing list