Module: kamailio
Branch: master
Commit: 60119faef5282b135ef7c972d15e1017ca26815a
URL: 
https://github.com/kamailio/kamailio/commit/60119faef5282b135ef7c972d15e1017ca26815a

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2020-07-07T17:25:00+02:00

core: io wait - unhash in case delete operation fails because of EBADF

- EBADF: epfd or fd is not a valid file descriptor

---

Modified: src/core/io_wait.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/60119faef5282b135ef7c972d15e1017ca26815a.diff
Patch: 
https://github.com/kamailio/kamailio/commit/60119faef5282b135ef7c972d15e1017ca26815a.patch

---

diff --git a/src/core/io_wait.h b/src/core/io_wait.h
index 251c65fdff..ddc7e80324 100644
--- a/src/core/io_wait.h
+++ b/src/core/io_wait.h
@@ -669,6 +669,12 @@ inline static int io_watch_del(io_wait_h* h, int fd, int 
idx, int flags)
                                        if (errno==EAGAIN) goto again_epoll;
                                        LM_ERR("removing fd %d from epoll list 
failed: %s [%d]\n",
                                                fd, strerror(errno), errno);
+                                       if (unlikely(errno==EBADF)) {
+                                               LM_ERR("unhashing of invalid fd 
- %d (epfd %d)\n", fd,
+                                                               h->h->epfd);
+                                               unhash_fd_map(e);
+                                               h->fd_no--;
+                                       }
                                        goto error;
                                }
 #ifdef EPOLL_NO_CLOSE_BUG


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to