1

I created an algorithm in nodejs using the cli terminal that receives an input of various values and makes the automated process of checking them in an api, so far so good, the problem is that he often stops this process and closes without any error or explanation. I have this problem with the VPS more than with my machine.

I forgot to mention that this process is done in parallel, the entries are separated into arrays and executed simultaneously x times at a time.

I thought it could be a possible memory leak since the process is a bit heavy but I have already done the test with less compliance and the result is the same and if it were he would warn me, the worst of all is that it only happens sometimes. Whoever had a similar problem could tell me how it was solved?

There is no code in the algorithm that closes the program, only after closing the loop, but it didn't have it before and even then it happened.

  • Please add your code as well – Sohail Ashraf Oct 30 '20 at 01:33
  • What is the exit code of your process? (ie `echo $?`) It's possible the OOM killer is to blame if your process is consuming almost all memory. Getting an instance with more RAM and/or enabling swap might help. – josh3736 Oct 30 '20 at 01:36
  • One idea is to add in a bunch of logs and run it again so you at least have an idea of where it stops. Another idea is that node simply exits because there are no more active event-listeners. (https://stackoverflow.com/questions/6442676/how-to-prevent-node-js-from-exiting-while-waiting-for-a-callback). – ippi Oct 30 '20 at 01:45
  • And depending on what dependencies you are using, a `debug=* node myapp.js` can be interesting (and slow) or do nothing at all. – ippi Oct 30 '20 at 01:49
  • Thank you! It is probably because he no longer hears listeners he closes. I will investigate and return with answers. – Henrique Araujo Oct 30 '20 at 02:01

0 Answers0