Repository navigation
Replies: 1 comment
|
I ran into similar Web UI performance issues and wanted to share my troubleshooting findings and a possible fix for reference. Environment: Linux, DSH 0.2.1-rc.2. Initially, the Web UI was extremely slow when accessed remotely, and sometimes failed to load entirely. After further investigation, I found that even requests to I discovered 184 DSH scopes that were still marked as active despite having no running processes: After verifying and cleaning up these empty scopes, responsiveness improved significantly without restarting DSH. All 60 subsequent local requests succeeded, with a median response time of approximately 2 ms. Looking through the code, I noticed that the existing cleanup condition for empty scopes depends on I've prepared a small patch that removes the requirement for a prior termination request while preserving the following safeguards:
I'm not an expert in this area, so please treat this patch as a suggestion rather than a definitive fix. Hopefully, it can serve as a useful reference. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
On Linux, a long-running
dsh webprocess accumulated 246 empty user-systemd scopes that remainedActiveState=active,TasksCurrent=0. The subprocess owner continued polling these scopes throughsystemctl show. A live CPU profile identified this polling path as the dominant sampled hotspot, while local HTTP requests and the Web UI were severely delayed.Observed impact: root HTML frequently took approximately 12–15 seconds, and a fresh authenticated Chromium page took 115.5 seconds to render the UI. It initially remained on
Loading plugins….Reproduction / observed workload
@deepseek-ai/dsh@0.2.0-rc.2with the Web profile on Linux with user systemd.PreToolUsehooks. The affected host had been running for approximately two days.dsh-subprocess-<harness-pid>-*.scopeunits and theirActiveStateandTasksCurrent.querySystemctl.This is an observed workload reproduction. The exact initial race/exit condition that first leaves a scope empty and active has not yet been reduced to a deterministic minimal reproducer. No plugin-free reproduction or runtime execution on alpha.1 is claimed.
Read-only commands for collecting the relevant systemd evidence:
Current behavior and measured evidence
Scope snapshot:
{ "total_scopes": 247, "active_scopes_with_TasksCurrent_0": 246, "active_scopes_with_TasksCurrent_68": 1 }The remaining populated scope was kept separate from the empty scopes; no cleanup or shutdown was performed during diagnosis.
CPU profile: 10,713 ms sampled duration, with 9,738 ms (90.9% of sampled time) in native
spawnon this stack:rangeActivequeriesLoadState,ActiveState, andTasksCurrent. Its polling loop backs off to a maximum of five seconds per owner, but hundreds of lingering owners still cause repeated process launches from the host.HTTP/browser observations:
pluginInventory/listRPC: 6.808 s. All 190 enabled components were active; this was not a required-plugin startup failure.Loading plugins….The detailed local CPU profile, scope snapshot, browser observation, and HTTP measurements were preserved. The figures above are measured observations, not estimates from source inspection.
Investigation
The installed
@deepseek-ai/dsh-subprocess-localfile is byte-for-byte identical to the npm0.2.0-rc.2file. The npm0.2.1-alpha.1lib/index.jsalso matched that file during comparison; alpha.1 itself was not run.In linux-scope.ts at the inspected upstream revision,
emptyRangerequiresterminationRequestedin addition to zero tasks and the existing direct-process/request-consumption check:Consequently, an empty unit that remains active can keep its polling owner alive unless that termination flag was set. This condition is consistent with the accumulated scopes and observed profiler stack. The initial cause of those empty active units still needs investigation.
Expected behavior
Once a managed range is proven to have completed and cannot receive its initial payload later, its observation should end and any leftover empty transient scope should be released, including natural-completion paths. This must preserve the existing startup-race protection and must not stop scopes containing live tasks or background descendants.
The Web host should remain responsive independently of the number of command/hook invocations that have already completed. A restart may temporarily discard observers but does not address the lifecycle defect.
Environment
@deepseek-ai/dsh:0.2.0-rc.2.@deepseek-ai/dsh-subprocess-local:0.2.0-rc.2, unmodified npm implementation.v25.2.1.24.04.3 LTS, x86_64; kernel7.0.0-34-generic.255.4-1ubuntu8.17, user-systemd scopes.PreToolUsehooks and additional plugins.No provider requests, session contents, credentials, or local private logs are included in this report. The diagnosis did not modify the runtime or restart the host.
All reactions