Browse Source

Fix socket descriptor leak

The connection to amqp was not getting cleaned up, even after the
communication to conductor across amqp was complete, for a given
request. Thus, sockets were leaking with each communication and finally
led to a hang situation, where no more fds were available.

Change-Id: I1deabdbce6ba448fe4c25d7694aabe5e5fec7b5a
Closes-Bug: #1510776
changes/33/264333/1
Surojit Pathak 6 years ago
parent
commit
873214b6e2
  1. 3
      magnum/api/hooks.py
  2. 3
      magnum/common/rpc_service.py

3
magnum/api/hooks.py

@ -81,6 +81,9 @@ class RPCHook(hooks.PecanHook):
def before(self, state):
state.request.rpcapi = conductor_api.API(context=state.request.context)
def after(self, state):
state.request.rpcapi = None
class NoExceptionTracebackHook(hooks.PecanHook):
"""Workaround rpc.common: deserialize_remote_exception.

3
magnum/common/rpc_service.py

@ -106,6 +106,9 @@ class API(object):
serializer=serializer,
timeout=timeout)
def __del__(self):
self._client.transport.cleanup()
def _call(self, method, *args, **kwargs):
return self._client.call(self._context, method, *args, **kwargs)

Loading…
Cancel
Save