Module: kamailio Branch: master Commit: 846cc5b97a907b5314ccf03772776e0d23434042 URL: https://github.com/kamailio/kamailio/commit/846cc5b97a907b5314ccf03772776e0d...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-07-07T17:37: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/846cc5b97a907b5314ccf03772776e0d... Patch: https://github.com/kamailio/kamailio/commit/846cc5b97a907b5314ccf03772776e0d...
---
diff --git a/src/core/io_wait.h b/src/core/io_wait.h index 251c65fdff..04186c72ad 100644 --- a/src/core/io_wait.h +++ b/src/core/io_wait.h @@ -669,6 +669,13 @@ 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->epfd); + unhash_fd_map(e); + h->fd_no--; + } + goto error; } #ifdef EPOLL_NO_CLOSE_BUG