Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Fix zmq socket.close() with eventlet 0.9.17
Browse files Browse the repository at this point in the history
A bug/change in eventlet 0.9.17 blocks the
kwargs from close() from passing through
to pyzmq. As this code was only explicitly
passing defaults, no argument is necessary.

This addresses file descriptor leaks reported
in bug 1099185. This bug does not affect
installations with eventlet<=0.9.16

The code will now log an error if a socket
cannot be closed.

Change-Id: Id438dab9744042328b7fac44693d02e116d8c1d9
  • Loading branch information
Eric Windisch committed Jan 13, 2013
1 parent d74668f commit f1b23c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions openstack/common/rpc/impl_zmq.py
Expand Up @@ -185,11 +185,15 @@ def close(self):
pass
self.subscriptions = []

# Linger -1 prevents lost/dropped messages
try:
self.sock.close(linger=-1)
# Default is to linger
self.sock.close()
except Exception:
pass
# While this is a bad thing to happen,
# it would be much worse if some of the code calling this
# were to fail. For now, lets log, and later evaluate
# if we can safely raise here.
LOG.error("ZeroMQ socket could not be closed.")
self.sock = None

def recv(self):
Expand Down

0 comments on commit f1b23c8

Please sign in to comment.