From a129adf13af4169b77e4917f08a595ee7d77a70b Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 26 Oct 2016 16:44:44 -0700 Subject: [PATCH 1/2] Remove fd from polling island before deleting it --- src/core/lib/iomgr/ev_epoll_linux.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index 8381f4a63a4..4358020f9b2 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1711,6 +1711,12 @@ retry: "pollset_add_fd: Raced creating new polling island. pi_new: %p " "(fd: %d, pollset: %p)", (void *)pi_new, fd->fd, (void *)pollset); + + /* No need to lock 'pi_new' here since this is a new polling island and + no one has a reference to it yet */ + polling_island_remove_all_fds_locked(pi_new, true, &error); + + /* Ref and unref so that the polling island gets deleted during unref */ PI_ADD_REF(pi_new, "dance_of_destruction"); PI_UNREF(exec_ctx, pi_new, "dance_of_destruction"); goto retry; From 485a902264dc96bad9e257611662e429adc8cb75 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 26 Oct 2016 16:46:55 -0700 Subject: [PATCH 2/2] minor formatting fix --- src/core/lib/iomgr/ev_epoll_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index 4358020f9b2..db51ec49392 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1713,7 +1713,7 @@ retry: (void *)pi_new, fd->fd, (void *)pollset); /* No need to lock 'pi_new' here since this is a new polling island and - no one has a reference to it yet */ + * no one has a reference to it yet */ polling_island_remove_all_fds_locked(pi_new, true, &error); /* Ref and unref so that the polling island gets deleted during unref */