Welcome! Log In Create A New Profile

Advanced

Re: ngx_http_upstream_check_broken_connection() is broken

Maxim Dounin
November 27, 2011 11:14AM
Hello!

On Sat, Nov 26, 2011 at 04:12:03PM -0500, Nicolas Viennot wrote:

> It goes like this:
>
> static void ngx_http_upstream_check_broken_connection(...) {
> ...
> n = recv(c->fd, buf, 1, MSG_PEEK);
> ...
> }
>
> Checking for closed connection with recv(..., MSG_PEEK) is broken.
>
> SSL closes are not detected, thus sockets stay in CLOSE_WAIT state forever
> -- nice DoS).
> The alternative is to use stunnel with the X-Forwarded-For patch, but
> that's way too messy.
>
> In ngx_http_upstream_check_broken_connection(), there seems to be a
> different path for kqueue.
> What about modifying the poll/epoll behavior to detect disconnections for
> other event modules ?
> In ngx_epoll_add_connection(), we can add the EPOLLHUP event, and mark the
> connection
> as disconnected when processing HUP events instead of using the buggy
> MSG_PEEK hack.
>
> What do you think ?

You've already got answer in nginx@ list:

http://mailman.nginx.org/pipermail/nginx/2011-November/030630.html

It makes a little sense to repeat the same question again.

Maxim Dounin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

ngx_http_upstream_check_broken_connection() is broken

Nicolas Viennot 1492 November 27, 2011 10:36AM

Re: ngx_http_upstream_check_broken_connection() is broken

Maxim Dounin 550 November 27, 2011 11:14AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 95
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready