一定时间后,节点应用无响应 [英] Node app unresponsive after certain amount of time

查看:132
本文介绍了一定时间后,节点应用无响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚为什么我的nodejs应用在11小时20分钟后变得无响应.不管我是在amazon-linux还是Red Hat上运行它,每次都会发生.

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.

我的堆栈:

  • nodejs(v.6.9.4)
  • mongodb(3.2)
  • pm2流程管理器
  • AWS EC2实例T2介质

每次我运行该应用程序时,它都会响应并返回到浏览器,并变得无响应:

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

net :: ERR_CONNECTION_RESET

net::ERR_CONNECTION_RESET

Pm2不会重新启动该应用程序,因此我怀疑它与nodejs无关,我也分析了该应用程序,并且它没有内存泄漏. db日志也看起来不错.

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.

唯一不变的因素是该应用在运行11小时20分钟后崩溃.

我正在处理nodejs应用程序中的所有可能的错误,但是日志文件中没有错误发生,因此我怀疑这必须是其他原因.

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.

我还检查了var/log/messages/home/centos/messages,但也与该应用程序的崩溃无关.

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也不显示任何特定内容.

/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 ?

谢谢

推荐答案

从注释中复制,因为它显然导致了解决方案:

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

我想,除了内存以外,您正在泄漏其他内容,也许是文件描述符.尝试使用netstat或lsof来查看打开的连接或文件是否比您预期的要多.

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.

这篇关于一定时间后,节点应用无响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆