-
Notifications
You must be signed in to change notification settings - Fork 38
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
Keepalive missed / reconnecting #291
Comments
Faced the same issue with current HEAD revision (b608a57) Here is the verbose logging:
It seems in line pyTwitchAPI/twitchAPI/eventsub/websocket.py Line 330 in b608a57
self._connection.receive() keeps listening to the stale connection even after closing it and reconnecting to the new connection.It will receive aiohttp.WSMsgType.CLOSED message after the 10 seconds timeout, and then start listening to the new connection, but at that time Twitch refuses the subscription with a 4003 error.
I think the easiest solution is to set the <10s timeout for ...
try:
message: WSMessage = await self._connection.receive(timeout=1)
except TimeoutError:
continue
... |
I think I found one edge case causing the |
I came here to report: I had the same problem - about once every 2 or 3 hours. Yesterday, I tried @kon72's solution and left it running for 12 hours overnight, and I came back here to confirm it worked (without commenting on whether it is the ideal solution - I haven't studied the code). I now see @Latent-Logic has a patch that takes a slightly different approach. I haven't tried that, but seems carefully considered, so I am hopeful. |
So my PR is only addressing one failure case when you've already hit a reconnect case and a 2nd issue can cause the library to forget the subscriptions that have been registered while trying to re-subscribe. I can see how the above receive timeout would much better handle the case when the |
TL;DR I assuming that this issue has something to do with socket connection.
I have an Issue which is hard to explain. Every ~30/45 minutes I have some network ananomly. When watching a stream/youtube video it just buffers for a second and when playing games, you dont notice any lag or anything, I am assuming that there might be a short lag spike burst or some sort of socket reconnect issue.
When this network issue accours i get the message
"keepalive missed, connection lost. reconnecting..."
In rare cases I get another traceback:
I looked into the Chat class :
the
check_connection()
is alwaysTrue
I tried changing some numbers on:
but this has no effect.
I tried upgrading from v 4.0.1 to 4.2.0 but its still the same issue, the only difference I noticed is that there is a new message
In rare situation it automaticly reconnects after 5-10 minutes.
I assuming that has something to do with socket connection & not with the twitch implementaiton
The text was updated successfully, but these errors were encountered: