-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERR_IPC_CHANNEL_CLOSED: Channel closed #94
Comments
Minimal repro: import { isMainThread } from "node:worker_threads";
import Tinypool from "tinypool";
const isMainProcess = process.send === undefined;
if (isMainProcess && isMainThread) {
console.log("Starting main pool");
const pool = new Tinypool({
filename: new URL(import.meta.url).href,
isolateWorkers: true,
});
await Promise.all([
pool.run({}, { name: "wrapper" }),
pool.run({}, { name: "wrapper" }),
pool.run({}, { name: "wrapper" }),
]);
}
export async function wrapper() {
console.log("Starting nested pool");
const pool = new Tinypool({
filename: new URL(import.meta.url, import.meta.url).href,
runtime: "child_process",
isolateWorkers: true,
minThreads: 8,
maxThreads: 8,
});
await pool.run({ a: 4, b: 6 }, { name: "sum" });
pool.recycleWorkers();
}
export async function sum({ a, b }) {
console.log("Running worker");
return a + b;
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error below comes up quite often on Vitest's codebase. Tests themselves are passing fine, but this error is visible on test logs. My initial guess is that Tinypool is shutting down before workers have finished loading user's entrypoint. These workers are likely the idle workers that are kept ready for next pool runs.
These errors should only come up when multiple pools are nested, e.g. running Tinypool in Tinypool.
As fix we could try adding a no-op callback here just to ignore these errors:
tinypool/src/entry/process.ts
Lines 42 to 46 in ea05a00
https://nodejs.org/api/process.html#processsendmessage-sendhandle-options-callback
The text was updated successfully, but these errors were encountered: