[SOLVED] FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory - noRetry

We have a very intensive method that makes the cpu and ram out of control.
We will improve this method.

The thing is, even if we restart the app (we use pm2), it continues to be out of memory.
It seems that meteor is trying to restart unfinished methods.

Is this correct ? Is there a way to prevent this ?

In the doc I see a noRetry option : Methods | Meteor API Docs
Is this noRetry can help in that case ?


I was able to reproduce the problem.

This solved the problem :

Meteor.applyAsync('/my-method',[options] , {wait: false, noRetry: true})

My takeaway is :

If you have a very intensive methods taht could potentielly lead to an out of memory, you should always call it with noRetry: true.
If you don’t do this, restarting your server will not help you.

1 Like

Thanks for sharing. This is very useful info.

Another solution is to move intensive methods on a job queue on another server that doesn’t affect the main servers accessed by users. This way, you can minimize affecting users of your app because of these methods