[nginx] svn commit: r4431 - in branches/stable-1.0: . src/event/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Sat Feb 4 23:18:13 UTC 2012


Author: mdounin
Date: 2012-02-04 23:18:12 +0000 (Sat, 04 Feb 2012)
New Revision: 4431

Log:
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.


Modified:
   branches/stable-1.0/
   branches/stable-1.0/src/event/modules/ngx_epoll_module.c


Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4305,4307-4309,4313,4315,4321,4326,4342-4343
   + /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326,4342-4343

Modified: branches/stable-1.0/src/event/modules/ngx_epoll_module.c
===================================================================
--- branches/stable-1.0/src/event/modules/ngx_epoll_module.c	2012-02-04 22:30:30 UTC (rev 4430)
+++ branches/stable-1.0/src/event/modules/ngx_epoll_module.c	2012-02-04 23:18:12 UTC (rev 4431)
@@ -683,6 +683,18 @@
 
         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;
 



More information about the nginx-devel mailing list