Skip to content

Keep the engine in a Type=notify service's cgroup - #117

Merged
T-Crypt merged 1 commit into
mainfrom
T-Crypt/notify-scope
Oct 21, 2026
Merged

T-Crypt merged 1 commit into
mainfrom
T-Crypt/notify-scope

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Fixes the regression @Bacongineer found in #116: since #112, a berth run that is the main command of a Type=notify service starts its engine in a separate scope. systemd accepts readiness only from the service's own cgroup, so the unit never leaves activating, even with NotifyAccess=all.

Inside such a service (NOTIFY_SOCKET is set), the run now starts the engine without a scope, as before #112. Everywhere else the scope stays. The escaped-child window stays open only for engines run under a notify service.

Proof:

  • The built binary as the main command of a Type=notify user service, the child calling systemd-notify --ready: main stays activating, this branch reaches active. It ran unleased against a missing socket, so it never touched the live daemon or the card.
  • TestScopeAllowed covers the decision.
  • Full proof green: build, gofmt, vet, go test ./..., Windows build and vet, golangci-lint (0 issues).

None of Berth's shipped units are Type=notify (gateway, berthd and the llama-swap unit are simple), so the default paths are unchanged.

systemd accepts sd_notify only from the service's own cgroup, so since the
cgroup scopes an engine that signals readiness from its new scope left the
unit in "activating". Inside such a service (NOTIFY_SOCKET set) the run now
starts the engine without a scope, as before. Measured with the built binary
as the main command of a Type=notify user service: activating before, active
after.
@T-Crypt
T-Crypt merged commit a377ec8 into main Oct 21, 2026
2 checks passed
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