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

Socket connection silently hangs up without a close event being triggered. #156

Closed
thebillkidy opened this issue May 13, 2014 · 5 comments

Comments

@thebillkidy
Copy link

@thebillkidy thebillkidy commented May 13, 2014

2 hours after opening a connection to the socket server, it hangs up silently. No onclose event is being fired towards the client.

I am using nginx as load balancer configured to use ssl, everything works for 2 hours and then it silently stops the connection.

@thebillkidy

This comment has been minimized.

Copy link
Author

@thebillkidy thebillkidy commented May 14, 2014

After digging in this further, a possible theory for this would be that the client stops sending heartbeats to the server. It also doesn't detect it when it stops sending heartbeats.

@brycekahle

This comment has been minimized.

Copy link
Contributor

@brycekahle brycekahle commented May 14, 2014

What transport was being used? This sounds suspiciously like something configured at the load balancer level.

@thebillkidy

This comment has been minimized.

Copy link
Author

@thebillkidy thebillkidy commented May 14, 2014

I am using the Websocket transport. I also enabled it to go through the load balancer (nginx) and it really works. On this moment I got 200+ connected sockets and most of them stay opened. But sometimes it closes the client connection silently without a onClose event being fired.

The thing I have been thinking about now is that the browser loses connection for more then 65+ seconds (nginx timeout) and this results in a disconnected socket without the onClose event.

Is it possible to have an onClose event on the client if the heartbeats didn't send for more then 65 seconds? or is this in the SockJS client already?

@3rd-Eden

This comment has been minimized.

Copy link

@3rd-Eden 3rd-Eden commented May 15, 2014

Why don't you just properly configure your nginx server? I doubt you have the proper proxy timeout's set see https://github.com/observing/balancerbattle/blob/master/nginx.conf#L53-L59 for an example

@thebillkidy

This comment has been minimized.

Copy link
Author

@thebillkidy thebillkidy commented May 15, 2014

Because I do not want disconnected clients to live on for 12 more hours before being cleaned from the pool? This is also kind of stupid, if we can clean up resources by removing sockets after 35 seconds then we should do this. It is also the reason that we send heartbeat packages?

Anyways, I just opened a pull request to check if heartbeats are being received from the server:
sockjs/sockjs-client#167

This fixed my problem and I hope this will help others too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.