Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Worker: a port table read that fails keeps the last one

Adarsh395aed23ba0e
diff --git a/bin/lib/worker/run.mjs b/bin/lib/worker/run.mjs
index 1b0bd4ad..3537eef4 100644
--- a/bin/lib/worker/run.mjs
+++ b/bin/lib/worker/run.mjs
@@ -926,8 +926,12 @@ async function work(saved, deps, owner) {
goodCountersAt = t;
} else if (goodCounters && t - goodCountersAt <= COUNTERS_REUSE_MS) counters = goodCounters;
if (counters && (t - listedAt >= 30_000 || (listing && unknownHolder(counters, listing, own.pid, busyMb)))) {
- listing = await (deps.readListeners ?? readListeners)(cfg.powershell);
- listedAt = t;
+ // A read that fails keeps the last port table (and is tried again on the next reading).
+ const read = await (deps.readListeners ?? readListeners)(cfg.powershell);
+ if (read) {
+ listing = read;
+ listedAt = t;
+ }
}
return splitMemory({
usedMb: reading.usedMb,
diff --git a/tests/worker-turns-run.test.ts b/tests/worker-turns-run.test.ts
index d2a5a68f..fd0f64a7 100644
--- a/tests/worker-turns-run.test.ts
+++ b/tests/worker-turns-run.test.ts
@@ -326,6 +326,22 @@ describe("studio jobs first", () => {
expect(p.logs.some((l) => /Another program is using the GPU/.test(l))).toBe(false);
});
+ it("the port table can't be read for a while: the last one stands, no busy pause", async () => {
+ const w = addWorker();
+ const p = pc();
+ addTask();
+ const gpu = fakeGpu(p, { workMb: 9000 });
+ let listOk = true;
+ const readListeners = gpu.readListeners;
+ start(w, p, { ...gpu, readListeners: async () => (listOk ? readListeners() : null) });
+ await until(() => workerRow(w).local_why === "waiting-for-yield");
+ listOk = false;
+ for (let i = 0; i < 30; i++) {
+ expect(workerRow(w).local_why?.startsWith("gpu-busy") ?? false).toBe(false);
+ await sleep(50);
+ }
+ });
+
it("a game holds the GPU: the busy pause, and no turn is asked for", async () => {
const w = addWorker();
const p = pc();