From da275543c5343d0609293b7778ef0659f60de930 Mon Sep 17 00:00:00 2001 From: adstep Date: Tue, 13 Oct 2026 18:57:28 -0700 Subject: [PATCH] benchmarks: don't crash the run when sending to a closed hub IPC channel A benchmark that hits its timeout keeps running in the background. If it later calls cluster.collect() after its hub processes were stopped or replaced, child.send emitted an unhandled ERR_IPC_CHANNEL_CLOSED 'error' and killed the whole run. Passing a send callback makes Node report the error there, so the late call rejects inside the abandoned benchmark instead. Copilot-Session: dae4a0ce-dfc4-425b-8f0e-68c3ceda6055 --- benchmarks/src/cluster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/src/cluster.js b/benchmarks/src/cluster.js index 4e30acb..91a807d 100644 --- a/benchmarks/src/cluster.js +++ b/benchmarks/src/cluster.js @@ -32,7 +32,7 @@ const request = (child, msg, expect) => promise.create((resolve, reject) => { const cleanup = () => { child.off('message', onMessage); child.off('exit', onExit) } child.on('message', onMessage) child.on('exit', onExit) - child.send(msg) + child.send(msg, (/** @type {Error|null} */ err) => { if (err) { cleanup(); reject(err) } }) }) export class Cluster {