Kill child processes
On Unix, child processes are not killed when parent dies. Each process is part of a process group (pgid). When pgid == pid, it is the process group leader. node creates child processes with the parent as the group leader (detached = false). You can send a signal to entire group using kill(-pgid), as in, negative value in argument. Systemd can be made to do this by setting the KillMode=control-group. Unrelated: Process groups reside inside session groups. Each session group has a controlling terminal. Only one process in the session group has access to the terminal. Process group is basically like a bash pipeline. A session group is the entire login session with only one process having terminal access at a time. Fixes #543
This commit is contained in:
@@ -92,6 +92,7 @@ function startAppTask(appId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// when parent process dies, apptask processes are killed because KillMode=control-group in systemd unit file
|
||||
gActiveTasks[appId] = child_process.fork(__dirname + '/apptask.js', [ appId ]);
|
||||
|
||||
var pid = gActiveTasks[appId].pid;
|
||||
|
||||
Reference in New Issue
Block a user