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?