You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found an issue that I believe is related to many others with similar and open issues. I think I also know how to solve it.
The Issue
So the issues is that Forever.stop(index | UID, false) kills the current or parent server/script. Instead of simply stopping the child process. Is there a killSignal that could also enable the main script to continue running.
Example
Note: When you run the example you will notice that the parent process is killed. Instead of simply stopping the child process.
varForever=require('forever');varpath=__dirname+'/test';varfile='app.js';varoptions1={max: 5,uid: 'test1',cwd: path,silent: true,killTree: true,// killSignal: ' ', // Is there a killSignal that might fix this?sourceDir: path,env: {port: 8001}};varoptions2={max: 5,uid: 'test2',cwd: path,silent: true,killTree: true,// killSignal: ' ', // Is there a killSignal that might fix this?sourceDir: path,env: {port: 8002}};varmonitor1=newForever.Monitor(file,options1);varmonitor2=newForever.Monitor(file,options2);monitor1.on('start',function(process){console.log('started');// correctly kill just the app process// console.log(process);// process.stop();});monitor1.on('restart',function(){console.log('restart');});monitor1.on('stop',function(){console.log('stopped');});monitor1.on('exit',function(){console.log('exit');});monitor1.on('error',function(error){console.log('error: '+error);});monitor2.on('start',function(process){console.log('started');});monitor2.on('restart',function(){console.log('restart');});monitor2.on('stop',function(){console.log('stopped');});monitor2.on('exit',function(){console.log('exit');});monitor2.on('error',function(error){console.log('error: '+error);});monitor1.start();monitor2.start();Forever.startServer(monitor1,monitor2);Forever.list(false,function(error,list){if(error)console.log(error);setTimeout(function(){/* THE ISSUE This triggers an exit which kills the current process script/server */Forever.stop('test2',false);// this correctly stops the app process and does not trigger exit then restarts// Forever.restart('test2', false);// console.log(list);},3000);});
The text was updated successfully, but these errors were encountered:
I found an issue that I believe is related to many others with similar and open issues. I think I also know how to solve it.
The Issue
So the issues is that
Forever.stop(index | UID, false)
kills the current or parent server/script. Instead of simply stopping the child process. Is there akillSignal
that could also enable the main script to continue running.Possibly Due To
killSignal
not detecting signals correctly ar and the following line:https://github.com/foreverjs/forever/blob/master/lib/forever.js#L519
Possible Fix
forever.config.get('exitOnStop')
https://github.com/foreverjs/forever/blob/master/lib/forever.js#L519
https://github.com/foreverjs/forever/blob/master/lib/forever/worker.js#L14
Example
Note: When you run the example you will notice that the parent process is killed. Instead of simply stopping the child process.
The text was updated successfully, but these errors were encountered: