vp run hangs after a failure when a cancelled task's detached descendant holds its IPC connection
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Start with the cancellation path in crates/vt/src/session/execute/spawn.rs and the IPC client drain in crates/vt_server/src/lib.rs, both linked in the issue. Reproduce with the supplied vp run repro setup, then trace how cancellation and open descendant connections affect shutdown. Done means fail-fast exits promptly with a nonzero status while a detached descendant holds the IPC connection; the issue names no tests.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
When a sibling task fails, vp run kills a cached task's direct child, then keeps running for as long as a detached descendant of that task holds its runner IPC connection. In the repro below, 20 seconds after the failure the task's process was dead, its detached child was alive, and the session was still running. Killing only the detached child let the session exit 1 at once.
We hit this with Playwright: its webServer starts vp dev in a detached process group, so when fail-fast SIGKILLs Playwright, the dev server survives with an open IPC connection and the session hangs until it is killed by hand (locally) or the job times out (CI).
Repro
package.json
{
"name": "ipc-hang-repro",
"private": true,
"type": "module",
"scripts": {
"fail": "node repro.cjs fail"
},
"devDependencies": {
"vite-plus": "1.3.0"
}
}
vite.config.ts
export default {
run: {
tasks: {
repro: {
command: 'echo done',
dependsOn: ['fail', 'cached'],
},
cached: {
command: 'node repro.cjs parent',
cache: { input: ['repro.cjs'], output: [] },
},
},
},
};
repro.cjs
const { spawn } = require('node:child_process');
const fs = require('node:fs');
switch (process.argv[2]) {
// Fails once the grandchild has connected.
case 'fail':
setInterval(() => {
if (fs.existsSync('ready.json')) {
console.log('FAIL: IPC connected; exiting 1');
process.exit(1);
}
}, 100);
break;
// The cached task: starts a detached child, then idles.
case 'parent': {
const child = spawn(process.execPath, [__filename, 'grandchild'], {
detached: true,
stdio: 'ignore',
});
child.unref();
setInterval(() => {}, 1000);
break;
}
// Opens a runner IPC connection, as `vp dev` does, and stays alive.
case 'grandchild': {
globalThis.client = require(process.env.VP_RUN_NODE_CLIENT_PATH).load();
globalThis.client.getEnv('PATH');
fs.writeFileSync(
'ready.json',
JSON.stringify({ parent: process.ppid, grandchild: process.pid }),
);
setInterval(() => {}, 1000);
break;
}
}
Run
bun install # any package manager
export PATH="$PWD/node_modules/.bin:$PATH"
rm -f ready.json
vp run repro > run.log 2>&1 &
runner=$!
sleep 20
kill -0 "$runner" && echo 'still running after 20s'
kill -KILL "$(node -p 'require("./ready.json").grandchild')"
wait "$runner"; echo "session exit=$?"
Observed
$ node repro.cjs fail ⊘ cache disabled
$ node repro.cjs parent
FAIL: IPC connected; exiting 1
still running after 20s
session exit=1
vp run: 0/1 cache hit (0%), 0/2 successful.
--last-details reports fail exit 1 and cached exit 137.
Expected
Fail-fast finishes promptly with a nonzero status, and the cancelled task's descendants don't keep the session alive.
Cause
At 9ba4cc9 (the commit Vite+ 1.3.0 pins):
- On Unix, cancellation SIGKILLs only the direct child (Windows terminates the job object).
- The IPC server then drains existing clients with no deadline, and a descendant that loaded the client from
VP_RUN_NODE_CLIENT_PATHkeeps its connection open. - Playwright's
webServerpassesprocess.envthrough and starts the server in a detached process group, and SIGKILL skips its teardown.
Possible fixes
- On cancellation, end the task's IPC client handlers, or bound the drain.
- Kill the task's process group or descendants (detached groups escape a group kill).
Related
- #822: keep going instead of cancelling sibling tasks.
- #485: on Windows, completion blocked by descendant-held stdio.
- #396: an earlier browser hang from descendant-held fspy locks.
Environment
macOS 27.0 (26A428), arm64; Vite+ 1.3.0; Node 24.22.1.
- Vorherrschende Sprache
- Rust
- Sterne
- 480
- Forks
- 50
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 70
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/vite-task
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
voidzero-dev/vite-task#888 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
voidzero-dev/vite-task#886 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
voidzero-dev/vite-task#884 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
voidzero-dev/vite-task#881 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
voidzero-dev/vite-task#879 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/vite-task
Ähnliche Issues
-
desktop documentation
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
vfarcic/dot-agent-deck#2008 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs triage
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
pbakaus/impeccable#1210 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement ux-opportunities
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
area: ci priority: P4 ready-for-agent
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
shep-pm/shep#1249 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`PartialEq` for `AssignedBigUint` treats different values as equalEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenstatus:untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
midnightntwrk/midnight-zk#600 ·
Maintainer antworten meist innerhalb von 2 Tagen