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
This commit is contained in:
parent
c3b84bff88
commit
873214b6e2
|
@ -81,6 +81,9 @@ class RPCHook(hooks.PecanHook):
|
||||||
def before(self, state):
|
def before(self, state):
|
||||||
state.request.rpcapi = conductor_api.API(context=state.request.context)
|
state.request.rpcapi = conductor_api.API(context=state.request.context)
|
||||||
|
|
||||||
|
def after(self, state):
|
||||||
|
state.request.rpcapi = None
|
||||||
|
|
||||||
|
|
||||||
class NoExceptionTracebackHook(hooks.PecanHook):
|
class NoExceptionTracebackHook(hooks.PecanHook):
|
||||||
"""Workaround rpc.common: deserialize_remote_exception.
|
"""Workaround rpc.common: deserialize_remote_exception.
|
||||||
|
|
|
@ -106,6 +106,9 @@ class API(object):
|
||||||
serializer=serializer,
|
serializer=serializer,
|
||||||
timeout=timeout)
|
timeout=timeout)
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self._client.transport.cleanup()
|
||||||
|
|
||||||
def _call(self, method, *args, **kwargs):
|
def _call(self, method, *args, **kwargs):
|
||||||
return self._client.call(self._context, method, *args, **kwargs)
|
return self._client.call(self._context, method, *args, **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue