Repository navigation
owner: never name user@NNNN as a listener's unit - #16
Merged
Merged
Conversation
7 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5.
When another user's listener can't be tied to a process ID, ports names it from that user's processes. If they all run under one systemd service, the row reads
systemd: <unit>and the stop hint issudo systemctl stop <unit>.A user's own processes outside any real service, such as
systemd --useritself or desktop apps inapp.slice/*.scope, sit directly under the session manager,user@1000.service. That was the innermost.serviceon their cgroup path, so the row readsystemd: user@1000. ports then recommendedsudo systemctl stop user@1000, which logs that user out and kills everything they run. It's the worst advice a stop path can give.serviceUnitnow never returnsuser@N. A process directly under the session manager belongs to no service.systemd: user@Ngo through the usual tie-break: a single known server for the port names the row, and anything else stays?withuser: <name>. That's the documented "ambiguous stays?" rule.user@1000.service/app.slice/foo.service) still name themselves. On cgroup v1 the undelegatedpidsline stops atuser@1000.serviceand comes first, so that line is now skipped rather than deciding the answer.How it was verified
Gate, locally with CI's versions: unit ✓, build ✓, integration ✓ (uncached), gofmt ✓, vet ✓, lint ✓ (v2.13.2).
TestServiceUnithas four new cgroup inputs, all failing on main:The existing cases (mysql, systemd-resolved, a user service inside user@1000, a session scope, nginx on v1) are unchanged.
Not verified live. This environment has no systemd, so the evidence is the cgroup-format tests. On a systemd host,
sudo -u nobody-style listeners exercise it.Risk
Tier: risky (what a stop recommends).
systemd: user@Nnow read?/user: <name>, or a real server via the tie-break. TheirunitJSON field goes away (it's optional, already absent on most rows). The stop hint becomessudo ports free Ninstead ofsudo systemctl stop user@N.Unitis set only inattribute()fromserviceUnit. Its readers (the stop dedupe key,stopFix,kill.go, doctor's owner finding, the unowned-row dedupe) all handle an empty unit already, and none does anything worse than before.A fresh-context review said ok to ship. Its one should-fix, the v1 line order, is the second commit. It also checked that skipping only the
user@prefix is the right scope:user-runtime-dir@has no processes,getty@hands off to a session scope, and no standard unit starts withuser@apart from the manager. Its same-class finding about nspawn containers is filed as #15.Notes for the release
ports never suggests
systemctl stop user@NNNNfor another user's listener. Those rows stay?with their owner unless a single known server explains them.Generated by Claude Code