Hi guys!
I have a rather big Node.js application. And I run it in a cluster mode. Also I have set up graceful reload according to documentation. And it worked perfectly while I was deploying from day to day.
Today, I had to apply hot fix, so I did not care about graceful reload. Uptime was about 30 days. I hit pm2 restart all and in process list I had status errored for first process. And error message was kind of "Process 1234 not found". Then I tried pm2 stop 0 to stop first process, and still was getting errored state. I hit last command some times and finally got it state stopped for first process. Then, I manually did the same for other processes.
And then, I got error report with this error from my application. The thing error reporting is set in application (uncaughtException listener), so it may mean error comes from PM2 code which is executing worker process if I'm correct. By the way, I can't say after what command this exception was fired.
RangeError: Maximum call stack size exceeded
at isDate.<anonymous> in /usr/lib/node_modules/pm2/node_modules/moment/moment.js:line 30
at prepareConfig.<anonymous> in /usr/lib/node_modules/pm2/node_modules/moment/moment.js:line 1337
at createFromConfig.<anonymous> in /usr/lib/node_modules/pm2/node_modules/moment/moment.js:line 1307
at createLocalOrUTC.<anonymous> in /usr/lib/node_modules/pm2/node_modules/moment/moment.js:line 1385
at local__createLocal.<anonymous> in /usr/lib/node_modules/pm2/node_modules/moment/moment.js:line 1389
at utils_hooks__hooks.<anonymous> in /usr/lib/node_modules/pm2/node_modules/moment/moment.js:line 16
at write in /usr/lib/node_modules/pm2/lib/ProcessContainer.js:line 150
at warn in console.js:line 44
at send in /usr/lib/node_modules/pm2/lib/ProcessContainer.js:line 43
at write in /usr/lib/node_modules/pm2/lib/ProcessContainer.js:line 153
I created a gist with all the important logs.
PM2 version: 0.15.5
Node.js version: 4.1.2
OS: CentOS 6.5
there is a familiar issue 1765, please help me.
Fixed in development branch
If you want to try it:
$ npm install Unitech/pm2#development -g
Great! Thank you so much!
If it is not important to have a single common location to have pm2 metadata folder stored on a installation. then you may try the following:
go to your node project where pm2 will be used.
for Windows
set PM2_HOME=.pm2
for Linux
export PM2_HOME=.pm2
this will place the .pm2 folder inside your project where pm2 will have write access.
Thanks nklt ! Your solution has fixed my "RangeError: Maximum call stack size exceeded" issue
I think that Windows was not able to access to my pm2 metadata folder.
If it is not important to have a single common location to have pm2 metadata folder stored on a installation. then you may try the following:
go to your node project where pm2 will be used.
for Windows
set PM2_HOME=.pm2for Linux
export PM2_HOME=.pm2this will place the .pm2 folder inside your project where pm2 will have write access.
If it is not important to have a single common location to have pm2 metadata folder stored on a installation. then you may try the following:
go to your node project where pm2 will be used.
for Windows
set PM2_HOME=.pm2for Linux
export PM2_HOME=.pm2this will place the .pm2 folder inside your project where pm2 will have write access.
this worked...
just run it in the cmd (windows - with admin permissions)
Most helpful comment
If it is not important to have a single common location to have pm2 metadata folder stored on a installation. then you may try the following:
go to your node project where pm2 will be used.
for Windows
set PM2_HOME=.pm2for Linux
export PM2_HOME=.pm2this will place the .pm2 folder inside your project where pm2 will have write access.