gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] branch master updated: fix 'race' between M


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: fix 'race' between MHD_epoll and MHD_daemon_quiesce on epoll listen FD removal, resolve simply by allowing syscall to fail with ENOENT
Date: Fri, 02 Mar 2018 22:56:44 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new f60a569e fix 'race' between MHD_epoll and MHD_daemon_quiesce on epoll 
listen FD removal, resolve simply by allowing syscall to fail with ENOENT
f60a569e is described below

commit f60a569e51224a9b6bb4de0c95fe8503d6951168
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Mar 2 22:56:41 2018 +0100

    fix 'race' between MHD_epoll and MHD_daemon_quiesce on epoll listen FD 
removal, resolve simply by allowing syscall to fail with ENOENT
---
 src/microhttpd/daemon.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 6179f2bc..0b85764b 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -4079,10 +4079,12 @@ MHD_epoll (struct MHD_Daemon *daemon,
   if ( (daemon->was_quiesced) &&
        (daemon->listen_socket_in_epoll) )
   {
-    if (0 != epoll_ctl (daemon->epoll_fd,
-                        EPOLL_CTL_DEL,
-                        ls,
-                        NULL))
+    if ( (0 != epoll_ctl (daemon->epoll_fd,
+                          EPOLL_CTL_DEL,
+                          ls,
+                          NULL)) &&
+         (ENOENT != errno) ) /* ENOENT can happen due to race with
+                                #MHD_quiesce_daemon() */
       MHD_PANIC ("Failed to remove listen FD from epoll set\n");
     daemon->listen_socket_in_epoll = false;
   }
@@ -4586,10 +4588,12 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
        (-1 != daemon->epoll_fd) &&
        (daemon->listen_socket_in_epoll) )
     {
-      if (0 != epoll_ctl (daemon->epoll_fd,
-                         EPOLL_CTL_DEL,
-                         ret,
-                         NULL))
+      if ( (0 != epoll_ctl (daemon->epoll_fd,
+                            EPOLL_CTL_DEL,
+                            ret,
+                            NULL)) &&
+           (ENOENT != errno) ) /* ENOENT can happen due to race with
+                                  #MHD_epoll() */
        MHD_PANIC ("Failed to remove listen FD from epoll set\n");
       daemon->listen_socket_in_epoll = false;
     }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]