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

How to listen to WebSocketConnectionClosedException to handle signalr server down? #48

Open
ngunhaSO opened this issue Nov 7, 2018 · 0 comments

Comments

@ngunhaSO
Copy link

ngunhaSO commented Nov 7, 2018

Anyone can recommend a best way to handle this exception "websocket._exceptions.WebSocketConnectionClosedException"? I am trying to use this in my django app, everything is fine but as long as the vendor shutdown the signalr, my django just throws out a bunch of exception with web socket connection closed.
The other thing is that, these exceptions even throws without being trigger from my django.

Here is the log:

2018-11-07T08:53:03Z <Greenlet "Greenlet-0" at 0x1105bed48: wrapped_listener> failed with WebSocketConnectionClosedException

Traceback (most recent call last):
File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/signalr/_connection.py", line 53, in wrapped_listener
listener()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/signalr/transports/_ws_transport.py", line 42, in _receive
for notification in self.ws:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 109, in iter
yield self.recv()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 302, in recv
opcode, data = self.recv_data()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 319, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 332, in recv_data_frame
frame = self.recv_frame()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 366, in recv_frame
return self.frame_buffer.recv_frame()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_abnf.py", line 361, in recv_frame
self.recv_header()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_abnf.py", line 309, in recv_header
header = self.recv_strict(2)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/abnf.py", line 396, in recv_strict
bytes
= self.recv(min(16384, shortage))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_core.py", line 441, in _recv
return recv(self.sock, bufsize)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websocket/_socket.py", line 94, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.

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

No branches or pull requests

1 participant