0

I have a Node.js program running continuously on a server. If a runtime error is thrown for whatever reason, it is caught and logged and an email is sent to me to let me know. BUT, sometimes the program does not throw an error... it just hangs. When this happens, it can take days for me to find out.

Is there some way to detect when a Node.js program is hanging? Ideally, I'd like the program to email me when this happens... however, I've noticed that one of the reasons my program might hang is if it runs out of memory. I doubt it would have enough memory left to send me an email at that point. Is there some other way for me to know about it?

bumbleshoot
  • 1,082
  • 2
  • 17
  • 32
  • 2
    Possible duplicate of [How to monitor the memory usage of Node.js?](https://stackoverflow.com/questions/20018588/how-to-monitor-the-memory-usage-of-node-js) – smac89 Oct 17 '19 at 03:33
  • 1
    You probably want to send this email before it hangs, so I suggest you consider asking how to detect memory leaks and send the email before the actual memory runs out – smac89 Oct 17 '19 at 03:34
  • 1
    https://www.npmjs.com/package/@airbnb/node-memwatch – Dženis H. Oct 17 '19 at 04:21

0 Answers0