-
Notifications
You must be signed in to change notification settings - Fork 4
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
Exception Occurred while using subscriptions API after running for approx 1 hour #5
Comments
Hi @jnitin, could you provide a reproduction environment so we can check it out faster? Also, Do you have additional information about the environment in which this issue arised? |
Apologies for late response. Few Details:- OS :- Ubuntu 18.04 Regarding server access it may not be possible but i can try to debug . Please inform me what details i need to collect to further debug this issue. Now it is getting reproduced very frequently within 10-15 mins . Maybe server closed the connection . But as per understanding client should try to reconnect to the server again since this issue is not reproduced with Altair client . https://altair.sirmuel.design/ Query :- Thanks for response . Regards |
Hi After further debugging , it seems that _bytes = 0 because server closed the connection and because of that exception is raised. def recv(sock, bufsize): bytes_ = sock.recv(bufsize)
However WebSocketConnectionClosedException is not handled in def _sub_routing_loop(self): function at below place:-
Here even though TimeoutError is handled but WebSocketConnectionClosedException is not handled . For Timeout error as we are trying to reconnect to the server , can we do similar handling in case of WebSocketConnectionClosedException as well . I tried and it seems it works but need confirmation as shown below:- 234.71 Please let me know it this approach is fine or does it have any side effects. Also is there any way to stop print messages from GraphQLClient.py and instead to redirect to logs . Best Regards/ |
With the above change tested continuously for more than 5 hours and even though multiple times closed connection is observed but every time reconnected and working fine now . Also this issue was observed on Windows as well and not platform specific. Is it possible to disable print logs ? Regards |
@jnitin Hi, sorry for the late response, Just instead of:
as you suggested, we did:
Which is practically the same behaviour |
Also, thanks for the suggestion about enabling / disabling the logs, I'll add it to the backlog, and come back to you when implemented. It's not a priority for us, but it would help in make the project which use this library have cleaner logs. What I was thinking would be a nice implementation would be an optional As long as the function receives a string as first parameter, it should work great (we use custom Logging functions in other projects, which prepend the current Date and other information, and making this library compatible with those loggers would be great) |
Hi
Thanks for this wonderful package . I am using subscriptions API from this package and it works fine ..
However after running for 1 hr , below exceptions is raised. Please let me know how to avoid this exception .
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(self._args, **self._kwargs)
File "/home//jsondatasource/venv/lib/python3.6/site-packages/pygqlc/GraphQLClient.py", line 222, in _sub_routing_loop
message = json.loads(self._conn.recv())
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/_core.py", line 310, in recv
opcode, data = self.recv_data()
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/_core.py", line 327, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/_core.py", line 340, in recv_data_frame
frame = self.recv_frame()
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/_core.py", line 374, in recv_frame
return self.frame_buffer.recv_frame()
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/_abnf.py", line 361, in recv_frame
self.recv_header()
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/_abnf.py", line 309, in recv_header
header = self.recv_strict(2)
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/abnf.py", line 396, in recv_strict
bytes = self.recv(min(16384, shortage))
File "/home//jsondatasource/venv/lib/python3.6/site-packages/websocket/_core.py", line 449, in _recv
return recv(self.sock, bufsize)
File "/home/*/jsondatasource/venv/lib/python3.6/site-packages/websocket/_socket.py", line 94, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
The text was updated successfully, but these errors were encountered: