Skip to content

Commit

Permalink
core: io wait - unhash in case delete operation fails because of EBADF
Browse files Browse the repository at this point in the history
- EBADF: epfd or fd is not a valid file descriptor

(cherry picked from commit 846cc5b)
  • Loading branch information
miconda committed Jul 16, 2020
1 parent d597ecd commit dc040c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/io_wait.h
Expand Up @@ -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
Expand Down

0 comments on commit dc040c8

Please sign in to comment.