Mercurial > hg > nginx-quic
view src/event/ngx_event_posted.h @ 6673:e4c1f5b32868
Event pipe: do not set file's thread_handler if not needed.
This fixes a problem with aio threads and sendfile with aio_write switched
off, as observed with range requests after fc72784b1f52 (1.9.13). Potential
problems with sendfile in threads were previously described in 9fd738b85fad,
and this seems to be one of them.
The problem occurred as file's thread_handler was set to NULL by event pipe
code after a sendfile thread task was scheduled. As a result, no sendfile
completion code was executed, and the same buffer was additionally sent
using non-threaded sendfile. Fix is to avoid modifying file's thread_handler
if aio_write is switched off.
Note that with "aio_write on" it is still possible that sendfile will use
thread_handler as set by event pipe. This is believed to be safe though,
as handlers used are compatible.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 01 Sep 2016 20:05:23 +0300 |
parents | 3d4730eada9c |
children | 9d2ad2fb4423 |
line wrap: on
line source
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #ifndef _NGX_EVENT_POSTED_H_INCLUDED_ #define _NGX_EVENT_POSTED_H_INCLUDED_ #include <ngx_config.h> #include <ngx_core.h> #include <ngx_event.h> #define ngx_post_event(ev, q) \ \ if (!(ev)->posted) { \ (ev)->posted = 1; \ ngx_queue_insert_tail(q, &(ev)->queue); \ \ ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, "post event %p", ev);\ \ } else { \ ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, \ "update posted event %p", ev); \ } #define ngx_delete_posted_event(ev) \ \ (ev)->posted = 0; \ ngx_queue_remove(&(ev)->queue); \ \ ngx_log_debug1(NGX_LOG_DEBUG_CORE, (ev)->log, 0, \ "delete posted event %p", ev); void ngx_event_process_posted(ngx_cycle_t *cycle, ngx_queue_t *posted); extern ngx_queue_t ngx_posted_accept_events; extern ngx_queue_t ngx_posted_events; #endif /* _NGX_EVENT_POSTED_H_INCLUDED_ */