From 5d5f0dcac4e3bbd4464aa1185d7fd51587a3119e Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Sun, 2 Apr 2017 14:32:29 +0300 Subject: 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. --- src/http/modules/perl/ngx_http_perl_module.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/http/modules/perl/ngx_http_perl_module.c') diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c index 79ded0f2f..6d3be9128 100644 --- a/src/http/modules/perl/ngx_http_perl_module.c +++ b/src/http/modules/perl/ngx_http_perl_module.c @@ -278,7 +278,7 @@ ngx_http_perl_sleep_handler(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); @@ -287,9 +287,6 @@ ngx_http_perl_sleep_handler(ngx_http_request_t *r) return; } - wev->delayed = 0; - wev->timedout = 0; - ngx_http_perl_handle_request(r); } -- cgit v1.2.3