Welcome! Log In Create A New Profile

Advanced

2 questions on send_timeout (maybe bugs)

Wu Bingzheng
May 18, 2011 05:16AM
hi all,


I meet 2 question when using nginx 1.0.0.


Question1.

what happens if the downstream connection breaks, before all data sent to the client?

1. get client's request
2. set handler: r->read_event_handle=ngx_http_block_reading
3. send data to client, and blocked ( write_filter.c:c->send_chain() returns non-NULL or non-error), and go back to epoll_wait
4. HERE, the downstream breaks
5. epoll detect the breaking, so epoll_wait() continues in ngx_epoll_process_events(), where the revents==EPOLL_IN | EPOLL_ERR | EPOLL_HUP. So we call rev->handler(), which calls r->read_event_handle, which dose nothing. AS A RESULT, the downstream breaking was not detected by nginx !!!
6. Then, we have to wait for send_timeout...

This situation dosenot occur everytime. If the downstream breaks, when nginx is sending data, the breaking will be detected.
But I can make this happen all the time, when:
1. the client and server are far away from each other (e.g. not in a local net)
2. using memc module



Question2.

I set 'send_timeout' as 20s, but nginx timeouts in 40s actually.

1. in src/http/ngx_http_upstream.c[line2448]:ngx_http_upstream_process_non_buffered_request(), a timer is added;
2. after that timer timeout, in src/http/ngx_http_request.c[line2179]:ngx_http_set_write_handler(), another timer is added again.

so the send_timeout is doubled.




Thanks
Wu

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

2 questions on send_timeout (maybe bugs)

Wu Bingzheng May 18, 2011 05:16AM

Re: 2 questions on send_timeout (maybe bugs)

Maxim Dounin May 18, 2011 09:36AM

Re:Re: 2 questions on send_timeout (maybe bugs)

Wu Bingzheng May 18, 2011 10:42PM

Re: Re: 2 questions on send_timeout (maybe bugs)

Maxim Dounin May 19, 2011 07:40AM

Re:Re: Re: 2 questions on send_timeout (maybe bugs)

Wu Bingzheng May 20, 2011 12:00AM

Re: Re: Re: 2 questions on send_timeout (maybe bugs)

Maxim Dounin May 20, 2011 07:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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