comparison src/os/unix/ngx_files.c @ 9202:e88cdaa0f1ff

AIO operations now add timers (ticket #2162). Each AIO (thread IO) operation being run is now accompanied with 1-minute timer. This timer prevents unexpected shutdown of the worker process while an AIO operation is running, and logs an alert if the operation is running for too long. This fixes "open socket left" alerts during worker processes shutdown due to pending AIO (or thread IO) operations while corresponding requests have no timers. In particular, such errors were observed while reading cache headers (ticket #2162), and with worker_shutdown_timeout.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 29 Jan 2024 10:31:37 +0300
parents ccb5ff87ab3e
children
comparison
equal deleted inserted replaced
9201:791ead216b03 9202:e88cdaa0f1ff
107 if (task == NULL) { 107 if (task == NULL) {
108 task = ngx_thread_task_alloc(pool, sizeof(ngx_thread_file_ctx_t)); 108 task = ngx_thread_task_alloc(pool, sizeof(ngx_thread_file_ctx_t));
109 if (task == NULL) { 109 if (task == NULL) {
110 return NGX_ERROR; 110 return NGX_ERROR;
111 } 111 }
112
113 task->event.log = file->log;
112 114
113 file->thread_task = task; 115 file->thread_task = task;
114 } 116 }
115 117
116 ctx = task->ctx; 118 ctx = task->ctx;
490 task = ngx_thread_task_alloc(pool, 492 task = ngx_thread_task_alloc(pool,
491 sizeof(ngx_thread_file_ctx_t)); 493 sizeof(ngx_thread_file_ctx_t));
492 if (task == NULL) { 494 if (task == NULL) {
493 return NGX_ERROR; 495 return NGX_ERROR;
494 } 496 }
497
498 task->event.log = file->log;
495 499
496 file->thread_task = task; 500 file->thread_task = task;
497 } 501 }
498 502
499 ctx = task->ctx; 503 ctx = task->ctx;