Mercurial > hg > nginx-quic
changeset 4430:e99e429947f9 stable-1.0
Merge of r4306, r4320:
Protection from stale write events in epoll.
Stale write event may happen if epoll_wait() reported both read and write
events, and processing of the read event closed descriptor.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 04 Feb 2012 23:18:12 +0000 |
parents | 2d235c76c59e |
children | 66ccd4ae6625 |
files | src/event/modules/ngx_epoll_module.c |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/event/modules/ngx_epoll_module.c +++ b/src/event/modules/ngx_epoll_module.c @@ -683,6 +683,18 @@ ngx_epoll_process_events(ngx_cycle_t *cy if ((revents & EPOLLOUT) && wev->active) { + if (c->fd == -1 || wev->instance != instance) { + + /* + * the stale event from a file descriptor + * that was just closed in this iteration + */ + + ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, + "epoll: stale event %p", c); + continue; + } + if (flags & NGX_POST_THREAD_EVENTS) { wev->posted_ready = 1;