-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Socket.io connects and disconnects only for some clients resulting in package lost / unreliability #4298
Comments
That sounds weird indeed. Do you know the Is this specific to a given browser? |
Not a specific browser, it happens on all their browsers which leads me to believe its a network issue? We get a ping timeout but disappears after a few times which makes think it might think its connected when its not? For separate clients we have seen a transport close error after few hours and no try to reconnect, is that normal or a way to fix or debug that? Thanks so much @darrachequesne |
+1! We're dealing with that but we don't know if is @aaronkchsu ping me, maybe we can gather info around this and share with @darrachequesne. The most common error we detect is |
I'm also experiencing a similar issue where clients occasionally report a 'ping timeout' and the server-side the corresponding transport close error. I debugged this by doing a tcpdump on the client-side. And what I observed is that the server very neatly sends the PING packet every 30s (my pingInterval, pingTimout is 10s). But when it fails it has sent the PING packet too late (after 42s, more than pingInterval + pingTimeout). So it smells like a server side issue to me. |
I have a similar problem with a flask-socketio server app hosted behind an aws alb and the client socket session seems to be consistently disconnecting every 26 seconds. Traceback (most recent call last): Client requests use /socket.io/?EIO=3&transport=polling&t=O9hzOSn&sid=xxxx Server version of SocketIO is 4.6.0 |
This could be related to the timeout of the TCP connections in the proxy servers or balancers in front of the app. We increased the TCP timeout and the stability of the connection was improved, but not 100%. In fact, the ping/pong heartbeat is designed not only to check the connection between server and client but is to maintain the connection alive to avoid proxy timeout, by default on proxies is 60 seconds. So, check if the interval is lower than the default value. Nginx timeout, AWS Load Balancer. Also, check this post: https://blog.martinfjordvald.com/websockets-in-nginx. |
The idle timeout was set to 30 seconds on the load balancer in AWS. I did increase this to 90 seconds this morning to see if this played a role in any way, and the consistent ~26 second session disconnects remained unchanged, |
As far as how SocketIO is configured in this server app, here is the code (it's quite vanilla): !/usr/bin/python coding: utf-8from flask import Flask from Config import ServerConfig from main.Utils import ServerLogger socketio = SocketIO() gLogger = ServerLogger() from dbinterface.DatabaseInterface import DatabaseInterface from settings.Settings import SettingsManager from robots.RobotsManager import RobotsManager from users.UserManager import UserManager def create_app(config_class=ServerConfig): |
And for the client: let ServiceModule = angular.module('ServiceModule', []); |
@johnfilo-kmart Do you consider the wake-up throttling in Chrome? In fact, is an active bug, check: https://bugs.chromium.org/p/chromium/issues/detail?id=1224672&q=websocket&can=2 You need to apply a technique to avoid this. |
Ooh, no I didn't know about that. I'll look into it. |
Describe the bug
A clear and concise description of what the bug is.
We have an nodejs websocket server with 3k+ concurrent connections. A few segment of clients disconnect and reconnect every few seconds/minutes.
We trigger the connection by joining to a room.
We use AWS ELB and their support says the load balancer has no problem.
On my machine i stay connected with the exact same roomId.
However his connection on the server end looks like this where it disconnects and reconnects. When we try to send the client a message using
io.to(roomId).emit()
it will only few of the messages instead of every message emittedOne of the clients that saw this behavior we tested with a different browser source from another websocket app and the messages work every time to his computer. The same client also had high speed spectrum internet.
To Reproduce
Our server settings - version 4.4.1
Server
Socket.IO client version:
x.y.z
Client
Expected behavior
Expect all clients to stay connected
Platform:
CPU Speed: 3700MHz
Additional context
I added a disconnect protocol which helped some clients that were international, but few clients still seeing this behavior
The text was updated successfully, but these errors were encountered: