Node app unresponsive after certain amount of time

谁说胖子不能爱 提交于 2019-12-07 12:08:25

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/42317561/node-app-unresponsive-after-certain-amount-of-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!