Because the code is not involved, to the operation of the TCP connection level at that time no screening,
Consult about the possible causes and solutions,
Existing HAproxy server, and nodejs (socket. IO) server
Users to establish connection with nodejs need: browser - & gt; Ali SLB - & gt; HA - & gt; NodeJS
Recently found that when no users use NodeJS machine still has a number of connections from HA (netstat command to see)
On the HA machines, however, can't see these connections,
================
Such as: in a NodeJS (13.8) on the machine performs
[13.8] $netstat - NAT | grep 10711
TCP 0 0 192.168.13.8:3007, 10711:192.168.13.13 ESTABLISHED
This output shows that 13.8 and 13.13 10711 set up a connection
However, the execution result on HA (13.13) is
[13.13] $netstat - NAT | grep 10711
[13.13] $
Without the connection information
================
This connection will disappear, now have not found due to the constantly accumulated, so by now restart NodeJS service solution, after the restart NodeJS service (don't have to restart the machine, just NodeJS process), the connection will disappear,
CodePudding user response:
Netstat anop, parameters o can view the TCP keepalive timer state, preliminary suspect you accumulate on the server of a TCP connection is the timer off state, this state is no keepalive detection, the timer is closed, never trigger expired, the code can be used in the setsockopt setting SO_KEEPALIVE to manually open,CodePudding user response: