Welcome! Log In Create A New Profile

Advanced

Is there a bug in ngx_http_upstream_module's broken connection check code?

June 23, 2011 12:14AM
In the function "ngx_http_upstream_check_broken_connection" of ngx_http_upstream.c, there is a code segment like below:


n = recv(c->fd, buf, 1, MSG_PEEK);
...
else { /* n == 0 */
err = 0;
}

Here use whether receiving 0 bytes from downstream client to judge whether the connection has been closed. However, if the downstream connection is https, and the connection is cosed, this n will never be 0. So the code fails to check the broken connection for https.

My test is create a connection by firefox and click the "Stop" button in the firefox. If the connection is http, n will be 0; but if the connection is https, n is always 1. I try to increase the peek read limit from 1 to 1000 and then n will get 37.

So is it a bug or I misunderstand something?

Thanks.
Subject Author Posted

Is there a bug in ngx_http_upstream_module's broken connection check code?

speedfirst June 23, 2011 12:14AM

Re: Is there a bug in ngx_http_upstream_module's broken connection check code?

Maxim Dounin June 23, 2011 08:14AM

Re: Is there a bug in ngx_http_upstream_module's broken connection check code?

speedfirst June 23, 2011 10:24PM

Re: Is there a bug in ngx_http_upstream_module's broken connection check code?

nviennot November 26, 2011 07:41AM

Re: Is there a bug in ngx_http_upstream_module's broken connection check code?

Maxim Dounin June 23, 2011 10:28PM

Re: Is there a bug in ngx_http_upstream_module's broken connection check code?

Maxim Dounin November 26, 2011 06:40PM

Re: Is there a bug in ngx_http_upstream_module's broken connection check code?

nviennot November 27, 2011 04:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 264
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready