Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] making ngx_http_upstream_test_connect catch "connection refused" with kqueue

Ruslan Ermilov
November 06, 2012 12:08PM
On Mon, Nov 05, 2012 at 10:18:28PM -0800, agentzh wrote:
> Hello!
>
> smallfish and I both ran into a small issue with the
> ngx_http_upstream_test_connect which does not catch errors like
> "Connection refused" when kqueue is used.
>
> The current logic only checks c->write->pending_eof but this error
> actually produced a read event on (at least) both Mac OS X and
> FreeBSD.
>
> I've attached a simple patch (for nginx 1.2.4) to fix this by checking
> both the read and write events.
>
> To reproduce the issue, please consider the following Nginx
> configuration snippet (assuming nothing is listening on the local port
> 1234):
>
> location = /t {
> proxy_pass http://127.0.0.1:1234/;
> }
>
> Accessing /t gives the following message in error.log:
>
> [error] 28474#0: *1 kevent() reported about an closed connection
> (61: Connection refused) while reading response header from upstream
>
> We can see that ngx_http_upstream missed it in
> ngx_http_upstream_test_connect but caught it when reading the
> (upstream) response header.
>
> After applying my patch, Nginx can now catch it in the context of connecting:
>
> [error] 34067#0: *1 kevent() reported that connect() failed (61:
> Connection refused) while connecting to upstream
>
> Best regards,
> -agentzh

Your patch looks good.

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

[PATCH] making ngx_http_upstream_test_connect catch "connection refused" with kqueue Attachments

agentzh 1332 November 06, 2012 01:20AM

Re: [PATCH] making ngx_http_upstream_test_connect catch "connection refused" with kqueue

Ruslan Ermilov 503 November 06, 2012 12:08PM

Re: [PATCH] making ngx_http_upstream_test_connect catch "connection refused" with kqueue

Maxim Dounin 672 November 06, 2012 12:56PM

Re: [PATCH] making ngx_http_upstream_test_connect catch "connection refused" with kqueue

agentzh 372 November 06, 2012 02:24PM

Re: [PATCH] making ngx_http_upstream_test_connect catch "connection refused" with kqueue

Maxim Dounin 640 November 16, 2012 01:30PM



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

Online Users

Guests: 212
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