mirror of https://github.com/lukechilds/node.git
Browse Source
This test checks that ownerless cluster worker handles are closed correctly on disconnection. Fixes: https://github.com/nodejs/node/issues/6561 PR-URL: https://github.com/nodejs/node/pull/6909 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>v7.x
committed by
cjihrig
1 changed files with 20 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||
'use strict'; |
|||
const common = require('../common'); |
|||
const http = require('http'); |
|||
const cluster = require('cluster'); |
|||
|
|||
cluster.schedulingPolicy = cluster.SCHED_NONE; |
|||
|
|||
const server = http.createServer(); |
|||
if (cluster.isMaster) { |
|||
server.listen(common.PORT); |
|||
const worker = cluster.fork(); |
|||
worker.on('exit', common.mustCall(() => { |
|||
server.close(); |
|||
})); |
|||
} else { |
|||
server.listen(common.PORT); |
|||
server.on('error', common.mustCall((e) => { |
|||
cluster.worker.disconnect(); |
|||
})); |
|||
} |
Loading…
Reference in new issue