Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reconnect with SSLDispatcher #855

Closed
wants to merge 1 commit into from
Closed

Fix reconnect with SSLDispatcher #855

wants to merge 1 commit into from

Conversation

j-a-n
Copy link
Contributor

@j-a-n j-a-n commented Aug 30, 2022

The default SSLDispatcher lacks a "timeout" method, which leads to the following when reconnecting:

Traceback (most recent call last):
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 363, in read
    op_code, frame = self.sock.recv_data_frame(True)
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_core.py", line 403, in recv_data_frame
    frame = self.recv_frame()
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_core.py", line 442, in recv_frame
    return self.frame_buffer.recv_frame()
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_abnf.py", line 338, in recv_frame
    self.recv_header()
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_abnf.py", line 294, in recv_header
    header = self.recv_strict(2)
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_abnf.py", line 373, in recv_strict
    bytes_ = self.recv(min(16384, shortage))
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_core.py", line 526, in _recv
    return recv(self.sock, bufsize)
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_socket.py", line 122, in recv
    raise WebSocketConnectionClosedException(
websocket._exceptions.WebSocketConnectionClosedException: Connection to remote host was lost.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 354, in setSock
    dispatcher.read(self.sock.sock, read, check)
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 72, in read
    if not read_callback():
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 366, in read
    return handleDisconnect(e)
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 407, in handleDisconnect
    dispatcher.timeout(reconnect, setSock)
AttributeError: 'SSLDispatcher' object has no attribute 'timeout'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspace/opsicommon/client/opsiservice.py", line 630, in run
    self._connect()
  File "/workspace/opsicommon/client/opsiservice.py", line 605, in _connect
    self._app.run_forever(  # type: ignore[attr-defined]
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 420, in run_forever
    setSock()
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 356, in setSock
    handleDisconnect(e)
  File "/workspace/.venv/lib/python3.10/site-packages/websocket/_app.py", line 407, in handleDisconnect
    dispatcher.timeout(reconnect, setSock)
AttributeError: 'SSLDispatcher' object has no attribute 'timeout'

@engn33r
Copy link
Collaborator

engn33r commented Aug 30, 2022

Duplicate of one edit found in PR #854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants