Skip to content

PORTW-17: Keep cgroup-based systemd matching and say what a stop affects - #31

Merged
JtheGunner merged 1 commit into
mainfrom
chore/PORTW-17-systemd-unit-match-breadth
Nov 12, 2026
Merged

JtheGunner merged 1 commit into
mainfrom
chore/PORTW-17-systemd-unit-match-breadth

Conversation

@JtheGunner

Copy link
Copy Markdown
Owner

Issue: https://youtrack.xn--wrm-hoa.li/issue/PORTW-17

Decision: the systemd detector keeps matching every process inside a service's cgroup instead of restricting the match to the unit's MainPID. For services such as nginx the master and its workers all hold the port; a MainPID-only match would send the workers to the generic fallback, where a signal is undone when the master respawns them and the port stays busy. Stopping the unit is the action that frees the port, the prompt already shows the exact command, and confirmation stays mandatory. The own-unit protection is unchanged.

What changes:

  • The query becomes systemctl [--user] show -p Restart -p MainPID <unit>, parsed as Key=Value lines so property order does not matter.
  • New detail Role: the holder is the main process or a child process of the unit. It is omitted when MainPID is missing or invalid; the match still happens.
  • Every systemd explanation carries the hint that systemctl stop ends the whole unit, including every process in it.
  • An unreachable systemctl still falls back silently to the generic detector.
  • Decision recorded in the Detector doc comment and under Decisions on record in CLAUDE.md; README sentence and CHANGELOG entry added.

Commits:

  • feat: show the holder's role and a whole-unit hint for systemd services

Review: independent review PASS on 1dd22b3.

Matching stays cgroup-based: workers of nginx-style services hold the port
too, and signalling them is undone by the master. The explanation now says
whether the holder is the main process and that systemctl stop ends the
whole unit.
@JtheGunner
JtheGunner merged commit 97d9048 into main Nov 12, 2026
3 checks passed
@JtheGunner
JtheGunner deleted the chore/PORTW-17-systemd-unit-match-breadth branch November 12, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant