惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
J
Java Code Geeks
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
美团技术团队
L
LangChain Blog
WordPress大学
WordPress大学
A
About on SuperTechFans
Martin Fowler
Martin Fowler
月光博客
月光博客
Y
Y Combinator Blog
U
Unit 42
D
Docker
Recent Announcements
Recent Announcements
Hugging Face - Blog
Hugging Face - Blog
B
Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(docker): clean active shell groups on parent signal ·...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main
11

// Docker All Scheduler tests cover docker all scheduler script behavior.

2-

import { spawnSync } from "node:child_process";

2+

import { spawn, spawnSync } from "node:child_process";

33

import { chmodSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";

44

import { tmpdir } from "node:os";

55

import path from "node:path";

@@ -68,6 +68,20 @@ async function waitFor(predicate: () => boolean, timeoutMs = 5_000): Promise<voi

6868

throw new Error("condition was not met before timeout");

6969

}

707071+

async function waitForChildClose(child: ReturnType<typeof spawn>, timeoutMs = 5_000) {

72+

return await new Promise<{ code: number | null; signal: NodeJS.Signals | null }>(

73+

(resolve, reject) => {

74+

const timeout = setTimeout(() => {

75+

reject(new Error("child did not close before timeout"));

76+

}, timeoutMs);

77+

child.once("close", (code, signal) => {

78+

clearTimeout(timeout);

79+

resolve({ code, signal });

80+

});

81+

},

82+

);

83+

}

84+7185

describe("scripts/test-docker-all scheduler", () => {

7286

it("parses the supported CLI options", () => {

7387

expect(parseDockerAllCliArgs([])).toEqual({

@@ -591,6 +605,117 @@ setInterval(() => {}, 1000);

591605

expect(readFileSync(donePath, "utf8")).toBe("done");

592606

});

593607608+

posixIt("cleans active shell command groups before parent signal exit", async () => {

609+

const root = createTempDir("openclaw-docker-all-parent-signal-");

610+

const leaderPath = path.join(root, "leader-exits.mjs");

611+

const runnerPath = path.join(root, "runner.mjs");

612+

const grandchildPidPath = path.join(root, "grandchild.pid");

613+

const readyPath = path.join(root, "ready");

614+

const secondGrandchildPidPath = path.join(root, "second-grandchild.pid");

615+

const secondReadyPath = path.join(root, "second-ready");

616+

let grandchildPid = 0;

617+

let secondGrandchildPid = 0;

618+

let runner: ReturnType<typeof spawn> | undefined;

619+

const childScript = [

620+

"const fs = require('node:fs');",

621+

"process.on('SIGTERM', () => {});",

622+

"process.on('SIGHUP', () => {});",

623+

`fs.writeFileSync(${JSON.stringify(readyPath)}, 'ready');`,

624+

"setInterval(() => {}, 1000);",

625+

].join("\n");

626+627+

writeFileSync(

628+

leaderPath,

629+

`

630+

import { spawn } from "node:child_process";

631+

import fs from "node:fs";

632+633+

const grandchild = spawn(process.execPath, ["-e", ${JSON.stringify(childScript)}], {

634+

stdio: "ignore",

635+

});

636+

fs.writeFileSync(${JSON.stringify(grandchildPidPath)}, String(grandchild.pid));

637+

process.on("SIGTERM", () => process.exit(0));

638+

setInterval(() => {}, 1000);

639+

`,

640+

"utf8",

641+

);

642+

writeFileSync(

643+

runnerPath,

644+

`

645+

import { runShellCommand } from ${JSON.stringify(

646+

new URL("../../scripts/test-docker-all.mjs", import.meta.url).href,

647+

)};

648+649+

await runShellCommand({

650+

command: ${JSON.stringify(`exec ${JSON.stringify(process.execPath)} ${JSON.stringify(leaderPath)}`)},

651+

env: process.env,

652+

label: "parent-signal-cleanup",

653+

timeoutKillGraceMs: 100,

654+

timeoutMs: 30_000,

655+

});

656+657+

await runShellCommand({

658+

command: ${JSON.stringify(

659+

[

660+

"exec",

661+

JSON.stringify(process.execPath),

662+

"-e",

663+

JSON.stringify(

664+

[

665+

"const { spawn } = require('node:child_process');",

666+

"const fs = require('node:fs');",

667+

"const child = spawn(process.execPath, ['-e', \"process.on('SIGTERM', () => {}); setInterval(() => {}, 1000);\"], { stdio: 'ignore' });",

668+

`fs.writeFileSync(${JSON.stringify(secondGrandchildPidPath)}, String(child.pid));`,

669+

`fs.writeFileSync(${JSON.stringify(secondReadyPath)}, 'ready');`,

670+

"setInterval(() => {}, 1000);",

671+

].join("\n"),

672+

),

673+

].join(" "),

674+

)},

675+

env: process.env,

676+

label: "parent-signal-second-command",

677+

timeoutKillGraceMs: 100,

678+

timeoutMs: 30_000,

679+

});

680+

`,

681+

"utf8",

682+

);

683+684+

try {

685+

runner = spawn(process.execPath, [runnerPath], {

686+

cwd: process.cwd(),

687+

stdio: ["ignore", "ignore", "pipe"],

688+

});

689+

await waitFor(() => existsSync(readyPath) && existsSync(grandchildPidPath));

690+

grandchildPid = Number.parseInt(readFileSync(grandchildPidPath, "utf8"), 10);

691+

expect(Number.isInteger(grandchildPid)).toBe(true);

692+

expect(isProcessAlive(grandchildPid)).toBe(true);

693+694+

runner.kill("SIGTERM");

695+696+

await expect(waitForChildClose(runner, 15_000)).resolves.toEqual({

697+

code: 143,

698+

signal: null,

699+

});

700+

await waitFor(() => !isProcessAlive(grandchildPid));

701+

expect(existsSync(secondReadyPath)).toBe(false);

702+

if (existsSync(secondGrandchildPidPath)) {

703+

secondGrandchildPid = Number.parseInt(readFileSync(secondGrandchildPidPath, "utf8"), 10);

704+

}

705+

expect(secondGrandchildPid).toBe(0);

706+

} finally {

707+

if (grandchildPid && isProcessAlive(grandchildPid)) {

708+

process.kill(grandchildPid, "SIGKILL");

709+

}

710+

if (secondGrandchildPid && isProcessAlive(secondGrandchildPid)) {

711+

process.kill(secondGrandchildPid, "SIGKILL");

712+

}

713+

if (runner?.pid && isProcessAlive(runner.pid)) {

714+

runner.kill("SIGKILL");

715+

}

716+

}

717+

});

718+594719

it("describes effective scheduler limits for operator errors", () => {

595720

expect(describeDockerSchedulerLimits(2, limits)).toBe(

596721

"parallelism=2 weightLimit=2 resources=docker=2 npm=2",