From 42ac6dbe2052913727b29f92d5415c4a5c4b845f Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Wed, 6 Jul 2016 17:13:56 -0700
Subject: [PATCH] Handle orphaned fds

---
 src/core/lib/iomgr/ev_epoll_linux.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c
index 0fb4399fa7..0e6cba7e4f 100644
--- a/src/core/lib/iomgr/ev_epoll_linux.c
+++ b/src/core/lib/iomgr/ev_epoll_linux.c
@@ -1548,6 +1548,14 @@ retry:
    *    polling_island fields in both fd and pollset to point to the merged
    *    polling island.
    */
+  
+  if (fd->orphaned) {
+    gpr_mu_unlock(&fd->mu);
+    gpr_mu_unlock(&pollset->mu);
+    /* early out */
+    return;
+  }
+
   if (fd->polling_island == pollset->polling_island) {
     pi_new = fd->polling_island;
     if (pi_new == NULL) {
-- 
GitLab