nginx-0.0.7-2004-07-14-00:24:56 import
diff --git a/src/event/modules/ngx_rtsig_module.c b/src/event/modules/ngx_rtsig_module.c
index e6b16fe..c78cb8f 100644
--- a/src/event/modules/ngx_rtsig_module.c
+++ b/src/event/modules/ngx_rtsig_module.c
@@ -643,7 +643,11 @@
 
             rev = c->read;
 
-            if (overflow_list[i].revents & (POLLIN|POLLERR|POLLHUP|POLLNVAL)) {
+            if (rev->active
+                && rev->event_handler
+                && (overflow_list[i].revents
+                                          & (POLLIN|POLLERR|POLLHUP|POLLNVAL)))
+            {
                 tested++;
 
                 if (ngx_threaded) {
@@ -658,7 +662,11 @@
 
             wev = c->write;
 
-            if (overflow_list[i].revents & (POLLOUT|POLLERR|POLLHUP|POLLNVAL)) {
+            if (wev->active
+                && wev->event_handler
+                && (overflow_list[i].revents
+                                         & (POLLOUT|POLLERR|POLLHUP|POLLNVAL)))
+            {
                 tested++;
 
                 if (ngx_threaded) {