Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

socket.io becoming slow and unresponsive after node server is left running for a couple days

I've been developing publishing features for my website using socket.io on a node server. I've been having issues over the past month or so with the socket connections becoming painfully slow or altogether unresponsive after only a couple days running. The server is not out of memory. I'm not fairly familiar with debugging this kind of issue.

The socket.io logs were not telling me much beyond "websocket connection invalid" or "client not handshaken 'client should reconnect'"

I had googled around and eventually saw a thread recommending running netstat in the command line and saw a large number of connections in FIN_WAIT2 and CLOSE_WAIT and figured that was the cause of my issue. After looking at some threads on the socket.io github related recommended upgrading to branch 0.9.14 (I had been running 0.9.13 at the time).

I have since done so and am still having periods of 'downtime' when the server has only been running for a few days straight. My site does not get anywhere near the amount of traffic where this should be an issue.

A new error has started popping up in my logs (websocket parser error: no handler for opcode 10), but my googling has turned up squat on the issue. I am not sure where to turn to resolve this issue or if I am simply after a red herring and the real issue is something else that one of you may be able to help me shed some light on.

I am running node.js v0.10.10 and using socket.io v0.9.14. A hard reboot of the linux server will resolve the issue 100% of the time whereas a restart of the node service does not, which is what has led me to believe it is an issue related to open sockets on the server.

like image 738
Billy Avatar asked Jun 16 '13 09:06

Billy


1 Answers

You are probably experiencing a known bug in node.js that was recently fixed - see issue#5504.

Is the problem still there after upgrading to node v0.10.11?

like image 127
Miroslav Bajtoš Avatar answered Oct 21 '22 14:10

Miroslav Bajtoš