-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
clusterIssues and PRs related to the cluster subsystem.Issues and PRs related to the cluster subsystem.
Description
- Version: *
- Platform: *
- Subsystem: cluster
When worker event loop is blocked, it can not disconnect from the master. So the proc.kill
will not be executed.
The SIGTERM
can not work is good for me. I wish SIGKILL
will work in this scenario as the doc.
'SIGKILL' cannot have a listener installed, it will unconditionally terminate Node.js on all platforms.
And here is the code.
'use strict';
const cluster = require('cluster');
const assert = require('assert');
const isMaster = cluster.isMaster;
if (isMaster) {
const worker = cluster.fork();
setTimeout(() => {
worker.kill('SIGKILL'); // worker.process.kill('SIGKILL');
}, 1000);
worker.on('exit', () => {
console.log('worker exit');
})
} else {
let i = 2;
while(true) {
i = i % 2;
}
}
worker.process.kill
works, but looks like odd.
Metadata
Metadata
Assignees
Labels
clusterIssues and PRs related to the cluster subsystem.Issues and PRs related to the cluster subsystem.