aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_limit_req_module.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2017-04-02 14:32:29 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2017-04-02 14:32:29 +0300
commit5d5f0dcac4e3bbd4464aa1185d7fd51587a3119e (patch)
treea5416b5d2589f61f3caa0ec749a1763dc7f19c53 /src/http/modules/ngx_http_limit_req_module.c
parent96e4e84ce273664d0ee43c5c5b7d14efa6f86d39 (diff)
downloadnginx-5d5f0dcac4e3bbd4464aa1185d7fd51587a3119e.tar.gz
nginx-5d5f0dcac4e3bbd4464aa1185d7fd51587a3119e.zip
Moved handling of wev->delayed to the connection event handler.
With post_action or subrequests, it is possible that the timer set for wev->delayed will expire while the active subrequest write event handler is not ready to handle this. This results in request hangs as observed with limit_rate / sendfile_max_chunk and post_action (ticket #776) or subrequests (ticket #1228). Moving the handling to the connection event handler fixes the hangs observed, and also slightly simplifies the code.
Diffstat (limited to 'src/http/modules/ngx_http_limit_req_module.c')
-rw-r--r--src/http/modules/ngx_http_limit_req_module.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/http/modules/ngx_http_limit_req_module.c b/src/http/modules/ngx_http_limit_req_module.c
index 4a79b479b..579b13c84 100644
--- a/src/http/modules/ngx_http_limit_req_module.c
+++ b/src/http/modules/ngx_http_limit_req_module.c
@@ -294,7 +294,7 @@ ngx_http_limit_req_delay(ngx_http_request_t *r)
wev = r->connection->write;
- if (wev->delayed && !wev->timedout) {
+ if (wev->delayed) {
if (ngx_handle_write_event(wev, 0) != NGX_OK) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -303,9 +303,6 @@ ngx_http_limit_req_delay(ngx_http_request_t *r)
return;
}
- wev->delayed = 0;
- wev->timedout = 0;
-
if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;