diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2017-11-20 16:31:07 +0300 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2017-11-20 16:31:07 +0300 |
| commit | b32cb6b61079d2eff69c89e0e718a79258507717 (patch) | |
| tree | e69f3694cce99d0315830aad61cf66e242c0afed /src/mail | |
| parent | f1c4853ea1a981073b067cd1356febd08b86f898 (diff) | |
| download | nginx-b32cb6b61079d2eff69c89e0e718a79258507717.tar.gz nginx-b32cb6b61079d2eff69c89e0e718a79258507717.tar.bz2 | |
Fixed worker_shutdown_timeout in various cases.
The ngx_http_upstream_process_upgraded() did not handle c->close request,
and upgraded connections do not use the write filter. As a result,
worker_shutdown_timeout did not affect upgraded connections (ticket #1419).
Fix is to handle c->close in the ngx_http_request_handler() function, thus
covering most of the possible cases in http handling.
Additionally, mail proxying did not handle neither c->close nor c->error,
and thus worker_shutdown_timeout did not work for mail connections. Fix is
to add c->close handling to ngx_mail_proxy_handler().
Also, added explicit handling of c->close to stream proxy,
ngx_stream_proxy_process_connection(). This improves worker_shutdown_timeout
handling in stream, it will no longer wait for some data being transferred
in a connection before closing it, and will also provide appropriate
logging at the "info" level.
Diffstat (limited to 'src/mail')
| -rw-r--r-- | src/mail/ngx_mail_proxy_module.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mail/ngx_mail_proxy_module.c b/src/mail/ngx_mail_proxy_module.c index 007284b68..1c86e54cf 100644 --- a/src/mail/ngx_mail_proxy_module.c +++ b/src/mail/ngx_mail_proxy_module.c @@ -882,10 +882,13 @@ ngx_mail_proxy_handler(ngx_event_t *ev) c = ev->data; s = c->data; - if (ev->timedout) { + if (ev->timedout || c->close) { c->log->action = "proxying"; - if (c == s->connection) { + if (c->close) { + ngx_log_error(NGX_LOG_INFO, c->log, 0, "shutdown timeout"); + + } else if (c == s->connection) { ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); c->timedout = 1; |
