简体   繁体   中英

Node stalls with ESTABLISHED TCP connections

I have a CentOS 7 server running several Node-scripts at specific times with crontab.
The scripts are supposed to make a few web requests before exiting. Which works fine at all times on my local machine (running Mac OS X).

However on the server it sometimes seems like the node script stalls around a web request and nothing more happens, leaving the process and taking up memory on the server. Since the script is working at my machine I'm guessing that there is some issue on the server. I looked at netstat -tnp and found that the stalled PID's have left connections open in ESTABLISHED state and without sending or receiving any data. The connections are left like this.

tcp 0 0 xxxx:39448 xxxx:443 ESTABLISHED 17143/node

It happens on different ports, different PID's, different scripts and to different IP-addresses.

My guess is that the script stalls because node is waiting for some I/O operation (the request) to finish, but I can't find out any reason why this would happen. Has anyone else had issues with node leaving connections open at random?

This problem was apparently not related to any OS or Node setting. Our server provider had made a change to their network, which caused massive packet loss between the router and server. They reverted the change for us and now it's working again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM