comparison src/http/modules/ngx_http_log_module.c @ 6927:c36d160cd4e0

Access log: removed dead ev->timedout check in flush timer handler. The ev->timedout flag is set on first timer expiration, and never reset after it. Due to this the code to stop the timer when the timer was canceled never worked (except in a very specific time frame immediately after start), and the timer was always armed again. This essentially resulted in a buffer flush at the end of an event loop iteration. This behaviour actually seems to be better than just stopping the flush timer for the whole shutdown, so it is preserved as is instead of fixing the code to actually remove the timer. It will be further improved by upcoming changes to preserve cancelable timers if there are other timers blocking shutdown.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 07 Mar 2017 18:51:12 +0300
parents 0cf4e82e7c48
children 3fb9b5eb75c0
comparison
equal deleted inserted replaced
6926:e662cbf1b932 6927:c36d160cd4e0
746 746
747 747
748 static void 748 static void
749 ngx_http_log_flush_handler(ngx_event_t *ev) 749 ngx_http_log_flush_handler(ngx_event_t *ev)
750 { 750 {
751 ngx_open_file_t *file;
752 ngx_http_log_buf_t *buffer;
753
754 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ev->log, 0, 751 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ev->log, 0,
755 "http log buffer flush handler"); 752 "http log buffer flush handler");
756 753
757 if (ev->timedout) { 754 ngx_http_log_flush(ev->data, ev->log);
758 ngx_http_log_flush(ev->data, ev->log);
759 return;
760 }
761
762 /* cancel the flush timer for graceful shutdown */
763
764 file = ev->data;
765 buffer = file->data;
766
767 buffer->event = NULL;
768 } 755 }
769 756
770 757
771 static u_char * 758 static u_char *
772 ngx_http_log_copy_short(ngx_http_request_t *r, u_char *buf, 759 ngx_http_log_copy_short(ngx_http_request_t *r, u_char *buf,