]> git.kaiwu.me - nginx.git/commitdiff
Events: fixed "port_dissociate() failed" alerts with eventport.
authorMaxim Dounin <mdounin@mdounin.ru>
Sun, 28 Mar 2021 14:45:29 +0000 (17:45 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Sun, 28 Mar 2021 14:45:29 +0000 (17:45 +0300)
If an attempt is made to delete an event which was already reported,
port_dissociate() returns an error.  Fix is avoid doing anything if
ev->active is not set.

Possible alternative approach would be to avoid calling ngx_del_event()
at all if ev->active is not set.  This approach, however, will require
something else to re-add the other event of the connection, since both
read and write events are dissociated if an event is reported on a file
descriptor.  Currently ngx_eventport_del_event() re-associates write
event if called to delete read event, and vice versa.

src/event/modules/ngx_eventport_module.c

index f67c70457f493218117729c79e48a3c6ab603424..d304e1c91004b3e0cec7843a479acae40a9b2161 100644 (file)
@@ -399,7 +399,7 @@ ngx_eventport_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
             return NGX_ERROR;
         }
 
-    } else {
+    } else if (ev->active) {
         ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0,
                        "eventport del event: fd:%d", c->fd);