Repository navigation
Replies: 1 comment
补充确认:
|
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.
Summary
On Windows, if the per-process spill directory
%TEMP%\dsh-subprocess-<random>is deleted while DSH is running (Windows Storage Sense does exactly this on a schedule via "Delete temporary files that my apps aren't using"), the next tool call whose output exceeds the in-memory cap kills the whole DSH host process:dsh-subprocess-localcaches the spill directory path for the process lifetime —privateSpillDir()doesdefaultSpillDir ??= mkdtempSync(join(tmpdir(), "dsh-subprocess-"))(lib/index.js:648-651) and never recreates it.OutputCollector.spillAll()then callsopenSync(this.spillFile, "wx", 384)(lib/index.js:716-717).openSyncthrowsENOENTinside a stream'data'handler (Socket.<anonymous>,lib/index.js:862), so it becomes an uncaught exception and the process exits with code 1.To users it looks "random" because two conditions must coincide: the temp dir was swept and the current command's output is large enough to trigger spilling.
Environment
@deepseek-ai/dsh0.1.2-rc.1 (npm global,dsh web)pwsh(Windows shell tool); any subprocess whose output spills shows the same failureStack trace (captured by an
uncaughtExceptionhandler)5 occurrences in 3 days, every one during a
pwshcall with large output:Invoke-WebRequestloop...\Temp\dsh-subprocess-Pegvq0\...-148-2-....lognpm pack --ignore-scripts...\Temp\dsh-subprocess-o9xYfd\...-2384-13-....logInvoke-WebRequestloop...\Temp\dsh-subprocess-ne7pjE\...-23568-2-....logdotnet build Ant_XYXH.csproj...\Temp\dsh-subprocess-Pprds5\...-14384-2-....logdotnet build LS_LSJSX.Common.csproj...\Temp\dsh-subprocess-EXGmcS\...-13524-7-....logCorroborating signals:
%LOCALAPPDATA%\Temponly ever holds the current process'sdsh-subprocess-*directory; all older ones are gone — something sweeps them.HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy:01=1,04=1). Its scheduled task ran at 16:48:48; the 17:39:50 crash followed ~51 minutes later.Deterministic repro
pwshcommand whose output overflows the in-memory cap, so%TEMP%\dsh-subprocess-XXXXXXexists.Remove-Item -Recurse $env:TEMP\dsh-subprocess-*), or let Storage Sense do it.pwshcommand → DSH exits with code 1 and the ENOENT above.Impact
The whole host dies mid-session: no tool error, no partial result, in-flight work is lost (any running session/agent dies with it). Users experience it as "DSH randomly crashes when using the shell tool".
Suggested fix (any one of these prevents the crash)
mkdirSync(dirname(this.spillFile), { recursive: true })beforeopenSync, or catchENOENTand recreate the directory + retry once.try/catchso a spill failure disables spilling (truncated output) rather than throwing out of a streamdatahandler.os.tmpdir()is routinely swept by Storage Sense / Disk Cleanup; a directory under the DSH home would be safer.Workaround we applied locally
TEMP/TMPat a dedicated directory (%USERPROFILE%\.dsh\tmp) in the launcher. Verified thatos.tmpdir()then resolves there (libuv on Windows readsTEMP, notTMPDIR), so the spill dir lives outside the swept%LOCALAPPDATA%\Temp.StoragePolicyvalue04 = 0).中文摘要:Windows 上若
%TEMP%\dsh-subprocess-*(子进程输出溢出目录)在 DSH 运行期间被删除(Windows 存储感知会定期清理「应用不使用的临时文件」),下一次大输出命令会在OutputCollector.spillAll的openSync抛ENOENT,而该异常发生在 streamdata回调中,直接导致未捕获异常、整个 DSH 进程退出(code 1)。建议在openSync前递归重建目录,或把溢出写失败降级为「输出截断」而不是抛异常;另建议 Windows 下不要把溢出目录放在系统临时目录。All reactions