-
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
"Session ID unknown" after handshake on high server load [Socket.io 1.0.6] #1739
Comments
I have the same problem... Any solution? |
same problem |
How's the stickiness configured? |
@Rundfunk @danielcha @guille I'm seeing the same thing. Intermittent 502's on a high load multi-node server. My sticky session configuration is very similar to what's in balancerbattle Still investigating - will update this ticket if I find anything helpful. |
Keep us posted. Please try it with |
Killer - thanks for the quick response. I'll let you know. |
upgrading to v1.2.1 didn't fix |
Do you guys have any further debugging information? Could it be a problem in the stickiness logic? |
Nothing of note yet - We're still investigating. Can't replicate in test environments, so debugging is tricky. I'll post here when/if we get something good. |
Btw, in your example this is interesting:
Notice the |
(since we have counters at the end of |
We finally figured this out. The root cause in our case:
We solved it by changing the nginx |
wow this is extremely useful feedback for others. Thanks a lot @runningskull. |
I think the very original 5xx error that triggered the chain was just some code that responded 500 as a run-of-the-mill error instead of a more useful error code. We'll probably do some more research soon into into something like using EDIT: worth mentioning that we had set proxy_next_upstream to do the behavior above on 5xx errors. By default nginx only does this on connection/header errors. However, it seems fairly common (best practice?) to |
Hi, I am having this same problem with nginx, node and socket.io. There is a way for nginx to use 'sticky' session ids passed along in the HTTP cookie that would solve it, but its part of their commerical offering. I was hoping the socket.io redis would address this by storing the session id in redis and using it from another socket.io-redis enabled node, but it doesn't work. Maybe this is something that could be made to work using the redis adaptor? |
@runningskull +1 thats explain a lot. |
for me, it was with nginx ssl http2, and it was polling, so the good config is: const ioSocket = io('', {
// Send auth token on connection, you will need to DI the Auth service above
// 'query': 'token=' + Auth.getToken()
path: '/socket.io',
transports: ['websocket'],
secure: true,
}); |
I had this problem hosting my project with Heroku when I switched to multiple dynos, I solved enabling the sticky sessions with |
Our application hosted in AWS and we have sticky session but still we have issue of Session ID unknown. Please let me know if any update on this. Socket IO : 1.7.3 |
socket.io is around 2.2, nodejs stable is v10, but we are using v12 and for the socket.io we only use websockets. |
So you think that we if I will upgrade socket io and node js will resolve problem? |
you should explicitly only use websockets as well as the comment says |
as you can see other people solved it as well, check the YES and HURRAY icons. |
I am getting fail in python socket client library where python always use first polling request. So from python client never getting connected. So any solution for that? |
DON'T FORGET TO CONFIGURE CLIENT AS WELL Making just nodejs backend to use in nodejs:
and in js client:
|
Thanks @jaykumarthaker it works for my cluster |
This fix the problem, with 'polling' my socket make too many requests |
For future readers: Please note that using Reference: https://socket.io/docs/v4/client-options/#transports @over2000 if HTTP long-polling makes too many requests, then that surely means something is wrong with the setup, like CORS. Please check our troubleshooting guide: https://socket.io/docs/v4/troubleshooting-connection-issues/ |
Issue mentioned in Socket.IO Documentation, how to handle in load balanced environment |
I am running a multi-node server (16 workers running Socket.io 1.0.6; accessed via Nginx, configured as a reverse proxy supporting sticky sessions) for ~ 5k users. While the load of the server is low (2
3 on a 20 core server / 2k users), everyone is able to connect instantly. When the load of the server gets higher (56 / 5k users), new users are not able to connect and receive data instantly. In this case, it takes 2~4 handshakes for the users to connect succesfully.This is what happens (high load):
io.connect(...)
){"sid":"f-re6ABU3Si4pmyWADCx","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}
)GET .../socket.io/?EIO=2&transport=polling&t=1408648886249-1&sid=f-re6ABU3Si4pmyWADCx
{"code":1,"message":"Session ID unknown"}
GET .../socket.io/?EIO=2&transport=polling&t=1408648888050-3
, notice the previously received SID is omitted){"sid":"DdRxn2gv6vrtZOBiAEAS","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}
)GET .../socket.io/?EIO=2&transport=polling&t=1408648888097-4&sid=DdRxn2gv6vrtZOBiAEAS
emit
ted in the worker source code.Depending on the load of the server, it may happen 1~3 times that the server responds with
"Session ID unknown"
and the client needs to perform a new handshake before data is actually received.The text was updated successfully, but these errors were encountered: