EvoluxBR/greenswitch

ESLProtocol.connect: Socket is not cleaned up if socket is closed

iuridiniz opened this issue · 0 comments

This issue is very similar to #82

When ESLProtocol.connect is called, it issues a socket.send, but, in rare cases, it could raise an exception if socket is already closed, but the socket is not cleanup

mai 22 16:18:14: Traceback (most recent call last):
mai 22 16:18:14:   File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
mai 22 16:18:14:   File "<retracted>/server.py", line 36, in _accept_call
mai 22 16:18:14:     super()._accept_call(session)
mai 22 16:18:14:   File "<retracted>/python/greenswitch/esl.py", line 593, in _accept_call
mai 22 16:18:14:     self._handle_call(session)
mai 22 16:18:14:   File "<retracted>/server.py", line 59, in _handle_call
mai 22 16:18:14:     super()._handle_call(session)
mai 22 16:18:14:   File "<retracted>/python/greenswitch/esl.py", line 596, in _handle_call
mai 22 16:18:14:     session.connect()
mai 22 16:18:14:   File "<retracted>/python/greenswitch/esl.py", line 362, in connect
mai 22 16:18:14:     resp = self.send('connect')
mai 22 16:18:14:   File "<retracted>/python/greenswitch/esl.py", line 213, in send
mai 22 16:18:14:     response = async_response.get()
mai 22 16:18:14:   File "src/gevent/event.py", line 329, in gevent._gevent_cevent.AsyncResult.get
mai 22 16:18:14:   File "src/gevent/event.py", line 359, in gevent._gevent_cevent.AsyncResult.get
mai 22 16:18:14:   File "src/gevent/event.py", line 347, in gevent._gevent_cevent.AsyncResult.get
mai 22 16:18:14:   File "src/gevent/event.py", line 327, in gevent._gevent_cevent.AsyncResult._raise_exception
mai 22 16:18:14:   File "<retracted>/python/gevent/_compat.py", line 66, in reraise
mai 22 16:18:14:     raise value
mai 22 16:18:14: greenswitch.esl.OutboundSessionHasGoneAway

The socket will stay in CLOSE_WAIT leaking a file descriptor forever