This is an automated email from the ASF dual-hosted git repository.

cliffjansen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 4eda877  PROTON-2112: prevent fd overflow recovery during proactror 
shutdown
4eda877 is described below

commit 4eda877fdca73e38633a201103e57fc1d8525832
Author: Cliff Jansen <[email protected]>
AuthorDate: Wed Jan 19 17:29:51 2022 -0800

    PROTON-2112: prevent fd overflow recovery during proactror shutdown
---
 c/src/proactor/epoll.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/c/src/proactor/epoll.c b/c/src/proactor/epoll.c
index adce4cc..19867af 100644
--- a/c/src/proactor/epoll.c
+++ b/c/src/proactor/epoll.c
@@ -756,7 +756,7 @@ static void proactor_rearm_overflow(pn_proactor_t *p) {
 // Close an FD and rearm overflow listeners.  Call with no listener locks held.
 int pclosefd(pn_proactor_t *p, int fd) {
   int err = close(fd);
-  if (!err) proactor_rearm_overflow(p);
+  if (!err && !p->shutting_down) proactor_rearm_overflow(p);
   return err;
 }
 
@@ -1639,13 +1639,14 @@ void pn_listener_free(pn_listener_t *l) {
 static void listener_begin_close(pn_listener_t* l) {
   if (!l->task.closing) {
     l->task.closing = true;
+    bool polling = !l->task.proactor->shutting_down;  // Is poller still 
running?
 
     /* Close all listening sockets */
     for (size_t i = 0; i < l->acceptors_size; ++i) {
       acceptor_t *a = &l->acceptors[i];
       psocket_t *ps = &a->psocket;
       if (ps->epoll_io.fd >= 0) {
-        if (a->armed) {
+        if (a->armed && polling) {
           shutdown(ps->epoll_io.fd, SHUT_RD);  // Force epoll event and 
callback
         } else {
           int fd = ps->epoll_io.fd;

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to