Repository navigation
[Bug] dsh web crashes with ENOENT when external temp cleanup removes the subprocess spill dir #3190
changingwang
started this conversation in
General
Replies: 2 comments
类似情况的另一种参考:在缓存命中分支补一个存在性检查与重建。安全性:runner 每次调用都会重新授予 temp SID 写权限( // packages/sandbox/sandbox-local/src/index.ts
const existing = this.tempCapabilities.get(key)
if (existing !== undefined) {
// OS temp hygiene or manual cleanup can remove the materialized
// directory between calls; recreate it so the runner's --temp
// validation still passes (the runner re-grants the temp SID).
if (!existsSync(existing.dir)) mkdirSync(existing.dir, { recursive: true })
return existing
}备选方案:
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@{title=[Bug] dsh web crashes with ENOENT when OS temp cleanup removes the subprocess spill dir (Windows); body=## Summary
dsh webcrashes with an uncaughtENOENTwhen the OS (or any external tool) cleans%TEMP%while dsh is running. The private per-process spill directory created bydsh-subprocess-localdisappears mid-run, so the next stdout write from a spawned subprocess fails hard and takes down the whole harness.This is on Windows 11 24H2, node v24.18.1, dsh
0.1.0-rc.7.Crash stack
Root cause analysis
privateSpillDir()(dsh-subprocess-locallib/index.js:348-350) lazily creates onemkdtempSyncdirectory per dsh process under the OS tmpdir:%TEMP%\dsh-subprocess-XXXXXX.OutputCollector.spillAll()(:417) callsopenSync(..., 'wx')to append a spawned subprocess's stdout/stderr once the in-memory cap overflows.%TEMP%\dsh-subprocess-*while dsh is still running, the nextopenSyncthrowsENOENTand it is uncaught → the whole dsh process crashes. The session log is cleanly truncated mid tool-call; there is no error event written anywhere.Repro steps
dsh web(any profile that spawns subprocesses / bash tools).%TEMP%\dsh-subprocess-*directory belonging to that process.Suggested fix
Make the spill path resilient to directory loss, e.g.:
openSync/writeSyncin try/catch and lazily re-create the per-process dir on failure (fs.mkdirSync(dir, { recursive: true })), orENOENTinspillAlland degrade to in-memory tail (markspillDisabled) instead of crashing, orexitso long-running installs don't accumulate, and tolerate a missing dir as a no-op.Happy to provide more detail or test a patch.; category_ids=System.Object[]}.body
All reactions