Repository navigation
Replies: 4 comments
|
Confirmed against v0.1.1-rc.2 source β your diagnosis is exact, and I traced the asymmetry that makes this a one-line bug rather than a design decision. Source facts (packages/host/webserver/src/index.ts)
README contract (packages/host/webserver/README.md line 9) states verbatim: "An upgrade-handler exception or upgraded-socket transport error is logged as a warning and destroys its socket" β the observed behavior (process exit) violates it. Fix (2 lines, minimal)
Regression test: your repro is already a test β after close, assert the upgraded socket still has at least one error listener, then emit an error on it: it must not throw and must not reach an uncaught-exception handler. Add a second case for the double-error path (error after destroy) to assert no warn spam. Family: teardown-timing cleanup overreach β the same shape as #4055 (client-hmr SSE upgrade channel) and the earlier quiesce work: a "stop acting on the thing" cleanup that accidentally removes the safety net. Worth a sweep for other Note for maintainers: commit |
|
Still present in Confirming this is not just a synthetic repro β it took down a long-running Version evidence (source-checked on the installed package)
socket.on("error", onError);
socket.once("close", () => {
socket.off("error", onError);
this.upgradedSockets.delete(socket);
});The Real-world crash (Windows, stock profile, no custom upgrade handlers) The host died mid-session and had to be restarted by a watchdog. Post-mortem can't pin down which exact socket fired (no per-socket tracing), but the stack matches this failure mode, the vulnerable lifecycle is still shipping, and the stock GUI's WebSocket upgrade path (api-gateway's mux) exercises upgraded sockets constantly β a browser reload/tunnel drop is enough to reach it. Compounding factor: no process-level backstop
Ask
Happy to test an alpha carrying the fix on the Windows setup where the crash was observed. |
|
Confirming this on the 0.2.2-rc.1 line, with a second failure path that the webserver-side fix does not cover. Environment
The webserver lifecycle is still shippingDumping socket.on("error", onError);
socket.once("close", () => {
socket.off("error", onError);
this.upgradedSockets.delete(socket);
});As of 2026-11-09, A webserver-only patch is not sufficientOn 2026-11-08 09:58 local I patched the installed bundle in place: At 2026-11-08 23:39β23:48 local it crashed six times in a row with the same signature: Each launch died 26β46 seconds after start. The last log line before one crash was: About 1.1 seconds later the fatal exception hit. In the same window, the other account's model-listing request had timed out after 5000 ms: So with the webserver upgrade socket patched, the remaining fatal path is on the HTTP-client side: a socket used for an outbound Process-level evidenceSince 2026-11-09 00:02 local I have run a profile-level Suggested direction
Happy to test a build carrying the fix on this Windows setup. |
|
Follow-up after 24 more hours of runtime on 0.2.2-rc.1, including one 12.5-hour clean run. Two findings worth adding to the record. 1. A process-level transport guard held for 12.5 hours with zero crashTo keep the host alive while waiting for the socket lifecycle fix, I run a profile-level Three consecutive host runs on 2.0.22-next / dsh 0.2.2-rc.1:
Two things this establishes:
2. The guard uninstalled itself once β and that is a bug worth fixing upstream tooDuring a That is the correct order here, but building it surfaced a real hazard for any process-level guard: cordis can apply a replacement before disposing the old fiber. My first version did Relevance upstream: if any fix lands as "retain the socket error listener for its full lifetime", the same lifetime question applies to whatever owns the process-level handler. A guard that uninstalls itself on reload is worse than no guard, because the logs still say it was armed. 3. A correction to my earlier commentIn my first comment I said the client-side path kept firing after the webserver patch. That is still true as a mechanism, but the observed rate is much lower than I implied: over 12.5 hours of guarded runtime the counter recorded zero late transport errors. The six crashes between 23:39 and 23:48 on 2026-11-08 remain real, but they were a startup-time burst, not a steady state. Recording that here so the data is not overread. 4. Ask is unchangedThe minimal webserver fix (retain the error listener, or install a permanent no-op sink after close) is still the right first step β Happy to test an alpha carrying either change on this Windows setup. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
@deepseek-ai/dsh-host-webserver@0.1.1-rc.2removes its upgraded socketerrorlistener in the socket'sclosecallback. A transport error delivered after that callback, such as a lateECONNRESETduring a browser reload or tunnel disconnect, then has no listener and is thrown as an unhandled EventEmitter error. This can terminate the entiredsh webprocess.I found this while testing an unofficial community plugin, but the reproduction below uses only the official published
dsh-host-webserverpackage and@deepseek-ai/cordis.This appears to conflict with the package README contract: an upgraded-socket transport error should be logged and its socket destroyed, and should never exit the process.
Environment
@deepseek-ai/dsh-host-webserver:0.1.1-rc.2(current npm release)0.1.0-rc.8; the relevant lifecycle is unchanged@deepseek-ai/cordis:4.0.1v25.4.0Relevant lifecycle
The upgrade handler installs
onError, then removes it onclose:Node may still deliver a queued transport error after the close callback has run.
Minimal reproduction
Install the two published packages in an empty directory, then run:
Observed:
The same probe leaves one listener and does not throw when a connection-lifetime compatibility listener is added before the upgrade.
Expected behavior
A late transport error on a closed upgraded socket must not become an uncaught exception or terminate the Harness process. The server should remain available for subsequent HTTP and WebSocket connections.
Suggested acceptance criteria
ECONNRESETdoes not throw.packages/host/webserver/tests/webserver.spec.ts.A possible implementation is to retain an
errorlistener for the socket's full object lifetime, or replace the logging handler with a no-op listener after close. The exact ownership choice is best made by the package maintainers.Related failure class: #3251 reports another process-fatal transport gap, but it concerns SDK stdout
EPIPE; this report is specifically the WebServer upgraded-socket close race.All reactions