RPC: Fail to disconnect an event when the server was closed
During the disconnect the object tries to connect again, and fail, as result the event is not removed.
If the server is started again, the events are received (while it was requested to be removed)
To me there is 2 issues
- The
disconnect
method should not fail - After the server re-creation the new events should not be received
tests/comm/test_rpc.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
bliss/common/event.py:40: in disconnect
sender = _get_sender(sender)
bliss/common/event.py:21: in _get_sender
sender = sender.__wrapped__
bliss/common/proxy.py:100: in __wrapped__
target = factory()
bliss/comm/rpc.py:722: in <lambda>
super().__init__(lambda: rpc_connection._proxy)
bliss/comm/rpc.py:585: in _proxy
self.connect()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <bliss.comm.rpc.RpcConnection object at 0x7fe0ded3d4d0>
def connect(self):
if self._reading_task:
return
if self.host:
try:
self._socket = socket.socket()
self._socket.connect((self.host, self.port))
# On the client socket we set low delay socket
# Disable Nagle and set TOS to low delay
self._socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self._socket.setsockopt(socket.SOL_IP, socket.IP_TOS, 0x10)
except socket.gaierror as sock_err:
# host does not exist ?
_msg = f"RPC - socket.gaierror connecting to {self.host}:{self.port} - ERR no {sock_err.errno} : {sock_err.strerror}"
raise CommunicationError(_msg) from sock_err
except socket.timeout as sock_err:
# ?
_msg = (
f"RPC - socket.timeout error connecting to {self.host}:{self.port}"
)
raise CommunicationError(_msg) from sock_err
except GreenletTimeoutError as grt_err:
# host is in DNS but OFF ?
_msg = (
f"RPC - GreenletTimeoutError connecting to {self.host}:{self.port}"
)
raise CommunicationError(_msg) from grt_err
except ConnectionRefusedError as cnx_err:
# port not open ?
_msg = f"RPC - ConnectionRefusedError '{cnx_err}' to {self.host}:{self.port}"
> raise CommunicationError(_msg) from cnx_err
E bliss.comm.exceptions.CommunicationError: RPC - ConnectionRefusedError '[Errno 111] Connection refused' to 127.0.0.1:12345
bliss/comm/rpc.py:568: CommunicationError