diff --git a/kombu/utils/eventio.py b/kombu/utils/eventio.py index fafb3ace..ed9ec06c 100644 --- a/kombu/utils/eventio.py +++ b/kombu/utils/eventio.py @@ -202,7 +202,14 @@ class _select(Poller): self.unregister(fd) def unregister(self, fd): - fd = fileno(fd) + try: + fd = fileno(fd) + except socket.error as exc: + # we don't know the previous fd of this object + # but it will be removed by the next poll iteration. + if get_errno(exc) in SELECT_BAD_FD: + return + raise self._rfd.discard(fd) self._wfd.discard(fd) self._efd.discard(fd)