From 7cab9c7811dab92a01ef0cbd6359153d39d0cbaa Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 1 May 2019 09:02:37 -0700 Subject: [PATCH] Remove fd from pollset when releasing the fd --- src/core/lib/iomgr/ev_epoll1_linux.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index c2165341964..4dff4579dac 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -383,6 +383,10 @@ static void fd_shutdown_internal(grpc_fd* fd, grpc_error* why, if (fd->read_closure->SetShutdown(GRPC_ERROR_REF(why))) { if (!releasing_fd) { shutdown(fd->fd, SHUT_RDWR); + } else { + if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_DEL, fd->fd, nullptr) != 0) { + gpr_log(GPR_ERROR, "epoll_ctl failed: %s", strerror(errno)); + } } fd->write_closure->SetShutdown(GRPC_ERROR_REF(why)); fd->error_closure->SetShutdown(GRPC_ERROR_REF(why));