Reputation: 4279
I'm running a node.js service on my Ubuntu 16.04 server. I came across a problem recently, where I get this error message: "UFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"
.
Now, I read here on SO that I can use something like: node --max-old-space-size=4096 yourFile.js
to fix this, however I don't start my service like that, I use supervisorctl start <servicename>
to start the service.
So, I am not sure how can I solve th problem in my case.
Can you suggest what should I do?
Upvotes: 1
Views: 9728
Reputation: 23545
supervisorctl use of a configuration file. It should be placed somewhere like :
/etc/supervisor/conf.d/myapi.conf
and look like :
[program:my-api]
command=node /home/myuser/myapi/app.js
autostart=true
autorestart=true
environment=NODE_ENV=production
stderr_logfile=/var/log/myapi.err.log
stdout_logfile=/var/log/myapi.out.log
user=myuser
add the running option inside of it :
[program:my-api]
command=node --max-old-space-size=4096 /home/myuser/myapi/app.js
autostart=true
autorestart=true
environment=NODE_ENV=production
stderr_logfile=/var/log/myapi.err.log
stdout_logfile=/var/log/myapi.out.log
user=myuser
Upvotes: 2