Search code examples
node.jslinuxmongodbamazon-web-servicespm2

Node app unresponsive after certain amount of time


I'm trying to figure out why my nodejs app becomes unresponsive after 11h 20min. It happens every time, no matter if I run it on amazon-linux or Red Hat.

My Stack:

  • nodejs (v. 6.9.4)
  • mongodb (3.2)
  • pm2 process manager
  • AWS EC2 instance T2 medium

Every time I'm running the app it becomes unresponsive with an error returned to the browser:

net::ERR_CONNECTION_RESET

Pm2 doesn't restart the app, so I suspect it has nothing to do with nodejs, I also analysed the app and it doesn't have memory leaks. Db logs also look alright.

The only constant factor is the fact that the app crashes after it runs for 11h 20min.

I'm handling all possible errors from the nodejs app, but no errors in the log files occur so I suspect it has to be something else.

I also checked var/log/messages and /home/centos/messages but nothing related to the crash of the app there either.

/var/log/mongodb/mongo.log doesn't show anything specific either.

What would be the best way to approach the problem ?

Any clues how can I debug it or what could be the reason ?

Thanks


Solution

  • Copied from the comment since it apparently led to the solution:

    You're leaking something other than memory is my guess, maybe file descriptors. Try using netstat or lsof to see if there are a lot more open connections or files than you expect.