My service has been updated to Node.js v6.9.4, and the connection of Socket.io is now disconnected frequently.
It was not reproduced in the development environment and decided to recover by returning to the state before updating.
Is this problem only with certain versions?
Will updating to the latest Node.js solve the problem?
Thank you for your cooperation.
The response time of the request (polling) before disconnection was 85 sec, and "400 Bad request" error was output in the next request.
(The response time in the normal state is 25 sec)
pound: (7f8592ce7700) e501 bad request "HQ" from xxx.xxx.xxx.xxx
pound: (7f84cdbe5700) BackEnd yyy.yyy.yyy.yyy:9443 dead (killed)
※ "xxx.xxx.xxx.xxx" or "yyy.yyy.yyy.yyy" is the IP address.
Browser ─[ HTTPS ]─ Load balancer(Pound) ─[ HTTP ]─┬─ Node.js Server 1
├─ Node.js Server 2
├─ Node.js Server 3
└─ Node.js Server 4
OS: CentOS 6.6Middleware for load balancing: pound ver.2.6OS setting change point:- Set the maximum number of usable processes to 100,000.- Set the limit number of file descriptors to 100,000.- Set memory map limit of pthread to 200,000.- Set the maximum number of threads to 100,000.
OS: CentOS 6.6
OS setting change point:
- Set the limit number of file descriptor to 100,000
- Update versions
- nod...@6.1.0 → 6.9.4
- sock...@1.4.6 → 1.7.2
- exp...@4.13.4 → 4.14.0
- body-...@1.15.1 → 1.15.2
- jqu...@2.2.3 → 3.1.1
- js...@9.0.0 → 9.9.1
- State at disconnection
The response time of the request (polling) before disconnection was 85 sec, and "400 Bad request" error was output in the next request.
(The response time in the normal state is 25 sec)
Thanks for your advice.
What if you just update the Node version? Try that first. The try updating one thing at a time and see where the thing breaks. Because when you update one of these npm packages, they will likely pull in many others as well, and some of those others might be flattened out by the new npm so your _other_ modules will also have new versions of their dependencies without realising it.
This problem can not be reproduced in the development environment.
You mean socket polling? Or what url specifically?
Yes. This is a polling log.
Below is the log output to the network tab of Firefox debugger when problems occur.
GET https://myapp.com/socket.io/?node...sport=polling.. 200 OK 24.99ms
POST https://myapp.com/socket.io/?node...sport=polling.. 200 OK 1ms
GET https://myapp.com/socket.io/?node...sport=polling.. 200 OK 25.01ms
POST https://myapp.com/socket.io/?node...sport=polling.. 200 OK 0ms
GET https://myapp.com/socket.io/?node...sport=polling.. 200 OK 1m 25s
POST https://myapp.com/socket.io/?node...sport=polling.. 400 Bad Request..
------ detail ------
NetworkError : 400 Bad Request - https://myapp.com/socket.io.......
--------------
POST https://myapp.com/socket.io/?node...sport=polling.. 400 Bad Request..
------ detail ------
NetworkError : 400 Bad Request - https://myapp.com/socket.io.......
--------------
One more idea. The great thing about Node 6 is that you can easilly run a debugger and attach chrome dev tools to it and monitor the state. At the very least, get a few dumps and check what's different between the old and new versions.