Repository navigation
[Bug] Linux: dsh-subprocess transient scopes accumulate and keep the user manager busy #12353
Kevin-McIsaac
started this conversation in
General
Replies: 0 comments
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.
Environment
dsh0.2.2-rc.1, Node 24.19.0dsh web --no-openruns as asystemd --userunit (~/.config/systemd/user/dsh-web.service)Summary
Each tool call creates a transient scope named
dsh-subprocess-<server-pid>-<hash>.scope. On this host the scopes are not released. They stayactive (running)after their command ends, and they survive the dsh server that created them. In about two days the user manager held 837 of them.Observed
The scope names carried server PIDs
3274,6792,17259,18495and18898. Those servers had exited days earlier. The live server was PID9142. So scopes from several dead server generations were still loaded and active.Impact
The guest was not idle overnight.
atophistory showssystemd --userat about 20% of one core and the whole VM at about 0.6 cores, with no session active. The accumulated state also kept the host CPU out of its low-power states, so the host fan ran all night on an otherwise idle machine.Workaround
This released 844 units in one step. Loaded units fell from 940 to 93, and a 12 second
/proc/statsample fell from 0.66 to 0.06 busy cores.systemd --userthen reported 0.0% intop.Reproduction
dsh webfrom asystemd --userservice on systemd 252.dsh-subprocess-*.scopeunits. Scopes from old server PIDs remain loaded and active.Code note
SystemdScopeOwneralready hasemptyRange()andreleaseEmptyRange(), andsystemd-runis called with--collect. For these units the release did not run. The owner was gone (server restart), or the unit never made the populated-to-empty transition.--collectonly collects units that reach inactive or failed, so such a unit stays active.Suggested fix
dsh-subprocess-<pid>-*.scopewhose<pid>is not the current server. The PID in the unit name makes this cheap.RuntimeMaxSecas a backstop.I can reproduce on request and provide
atopsamples,systemctl showoutput, or a debug log.All reactions