mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-11 00:06:06 +00:00
fix: socat zombie reaping, reconcile filter, and polling logs
- Consume proc.exited promise to prevent zombie socat processes - Use container name prefix filter instead of ancestor (matches containers from older image builds) - Improve polling logs to show retry count and waiting state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
268b5ee2a8
commit
bead746bb8
@@ -38,7 +38,6 @@ export async function startForwarding(branch: string, wtDir: string): Promise<bo
|
||||
|
||||
const containerIp = await getContainerIp(branch);
|
||||
if (!containerIp) {
|
||||
console.log(`[socat] no sandbox container found for ${branch}, skipping`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,6 +54,8 @@ export async function startForwarding(branch: string, wtDir: string): Promise<bo
|
||||
`TCP-LISTEN:${port},fork,reuseaddr`,
|
||||
`TCP:${containerIp}:${port}`,
|
||||
], { stdout: "ignore", stderr: "pipe" });
|
||||
// Consume the exit promise so Bun reaps the child (prevents zombies)
|
||||
proc.exited.then(() => {});
|
||||
entry.ports.push({ host: port, proc });
|
||||
console.log(`[socat] forwarding :${port} → ${containerIp}:${port} (branch=${branch}, pid=${proc.pid})`);
|
||||
}
|
||||
@@ -96,7 +97,7 @@ export async function reconcileForwarding(getWorktreeDir: (branch: string) => st
|
||||
// No orphans found (pkill exits non-zero when no match)
|
||||
}
|
||||
|
||||
const ps = await $`docker ps --filter ancestor=windmill-sandbox --format {{.Names}}`.text();
|
||||
const ps = await $`docker ps --filter name=wm- --format {{.Names}}`.text();
|
||||
const names = ps.trim().split("\n").filter(Boolean);
|
||||
|
||||
for (const name of names) {
|
||||
|
||||
@@ -173,11 +173,13 @@ export async function addWorktree(
|
||||
// so we poll in the background rather than blocking the API response.
|
||||
if (profile === "agent-yolo" && wtDir) {
|
||||
(async () => {
|
||||
for (let i = 0; i < 15; i++) {
|
||||
console.log(`[socat] waiting for container to start for ${branch}...`);
|
||||
for (let i = 1; i <= 15; i++) {
|
||||
await new Promise(r => setTimeout(r, 2000));
|
||||
if (await startForwarding(branch, wtDir)) return;
|
||||
console.log(`[socat] container not ready for ${branch}, retrying (${i}/15)...`);
|
||||
}
|
||||
console.error(`[socat] gave up waiting for container for ${branch}`);
|
||||
console.error(`[socat] gave up waiting for container for ${branch} after 30s`);
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user