From 21936d78843750c546fa0a9e939624ffcb87aee3 Mon Sep 17 00:00:00 2001 From: merge-check <140916359+agentHits@users.noreply.github.com> Date: Mon, 16 Nov 2026 06:00:28 -0500 Subject: [PATCH] test(acme): count a zombie docker client as gone in the signals test "leaves no orphaned docker client behind when it gives up" (without timeout) failed in a container whose PID 1 is `sleep infinity`. The script kills the hung docker client and the subshell that started it, so the client is left to PID 1. A PID 1 that never reaps keeps it as a zombie for good, and `process.kill(pid, 0)` still succeeds on a zombie, so the test waited 20 s for a process that had already ended. GitHub's runners reap through systemd, which is why CI passed. `alive` now also reads the state from /proc//stat and treats `Z` as gone; without /proc it keeps the old answer. The cleanup test waits for Node to see its own child exit (exit or signal code), since a direct child is a zombie for a moment before Node reaps it, and its assertion is about that signal code. Checked in that container: all 26 domain-overview files passed three runs in a row (429 tests), where the unchanged base failed this test every run. Co-Authored-By: Claude Opus 5.5 --- .../domain-overview/acme-delete-signals.test.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/__test__/domain-overview/acme-delete-signals.test.ts b/apps/dokploy/__test__/domain-overview/acme-delete-signals.test.ts index cc86418b5a6..39a9767c084 100644 --- a/apps/dokploy/__test__/domain-overview/acme-delete-signals.test.ts +++ b/apps/dokploy/__test__/domain-overview/acme-delete-signals.test.ts @@ -59,13 +59,21 @@ const recover = (shell: string, env: Record = {}) => { encoding: "utf8", env: baseEnv(env) }, ); +// A killed client whose parent shell was killed too is left to PID 1. In a +// container whose PID 1 never reaps (`sleep infinity`), it stays a zombie for +// good, and signal 0 still reaches a zombie, so it would count as running. const alive = (pid: number) => { try { process.kill(pid, 0); - return true; } catch { return false; } + try { + const stat = readFileSync(`/proc/${pid}/stat`, "utf8"); + return stat.slice(stat.lastIndexOf(")") + 2)[0] !== "Z"; + } catch { + return true; + } }; describe.skipIf(!REAL_JQ).each(SHELLS)( @@ -253,7 +261,9 @@ describe.skipIf(!REAL_JQ).each(SHELLS)( killLeftovers(); - await waitFor(() => !alive(pid)); + await waitFor( + () => job.child.signalCode !== null || job.child.exitCode !== null, + ); expect(job.child.signalCode).toBe("SIGKILL"); }); },