Repository navigation
Conversation
Units installed before get-bb#7039 default to OOMPolicy=stop, so one OOM-killed child stops the whole daemon. On start, a systemd user unit that sets no OOMPolicy gets a 50-oom-policy.conf drop-in and a daemon-reload, with no restart and no other drop-in touched. test-change-reason: new module covered by a new test file; no existing test changed.
A drop-in such as 10-custom.conf with OOMPolicy=kill would be overridden by the later 50-oom-policy.conf. The migration now skips when any .conf in the unit's drop-in directory sets OOMPolicy. test-change-reason: new test for the sibling drop-in case; existing tests unchanged.
…ives When the target drop-in name exists without an OOMPolicy directive, write the policy to the first free 50-oom-policy-N.conf instead of renaming over it. test-change-reason: new regression test for the pre-existing unrelated drop-in; existing tests unchanged.
…art retries The drop-in alone made later starts report already-current without a reload. test-change-reason: new regression test for reload failure then retry; existing tests unchanged.
…s the drop-in A directive under [Unit], [Install] or a comment is ignored by systemd, so it must not suppress the migration. test-change-reason: new regression tests for misplaced-section and comment cases; existing tests unchanged.
…he scan is never overwritten or removed test-change-reason: new deterministic collision-race tests (file created between scan and write, and reload failure with a colliding file); existing tests unchanged.
…he scan test-change-reason: new deterministic interleaving test (sibling OOMPolicy appears after the scan); existing tests unchanged.
… call created test-change-reason: new test where a replacement file appears before a failed reload; existing tests unchanged.
… and rollback test-change-reason: owner ruling on PR 573 simplifies the migration (one bb-owned file, reload keyed on systemctl show); tests rewritten for the new contract and the race and rollback tests removed with their code.
Collaborator
Author
|
Final-head check at 0265e95:
|
…arch path count test-change-reason: Hermes found drop-ins outside the unit directory were missed; the skip decision now reads systemctl cat output, with new tests for a non-adjacent admin drop-in and a failing cat.
Collaborator
Author
|
Head df103ea:
|
test-change-reason: Hermes found a drop-in path with a space was not recognised as a header, so its OOMPolicy was missed; new regression test fails at df103ea.
albrand
deleted the
bb/wsl-hostd-oom-bb-host-daemon-grows-to-44-gb-and-thr_8mp3faezeu
branch
November 25, 2026 04:29
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.
Root cause
Host daemon units installed before get-bb#7039 never got
OOMPolicy=continue(apps/server/src/assets/install-machine.sh:1178only runs on an explicit install). With the systemd defaultOOMPolicy=stop, the kernel OOM-killing one child stops the whole unit; this took down the hsrpc-wsl daemon and its sessions on 2026-11-24.Change
On every daemon start (
apps/host-daemon/src/app.ts:1212, inonStart, which also runs after a self-update restart),ensureUnitOomPolicyfinds this daemon's systemd user unit with the existingfindServiceDefinitionand:systemctl --user cat <unit>, which prints the unit and every drop-in from every systemd search path in load order. If any[Service]section outside bb's own file setsOOMPolicy=, it does nothing. Ifcatfails it writes nothing and the failure is logged.<unit>.service.d/50-bb-oom-policy.conf(OOMPolicy=continue) atomically when it is missing or differs.systemctl --user daemon-reloadwhensystemctl --user show -p OOMPolicy <unit>is notcontinue.No restart, no rollback, no file is ever deleted, other drop-ins are never touched. A failed reload is logged and retried on the next start.
Threat model (owner ruling): one writer, bb at daemon start. A concurrent edit of
~/.config/systemdby another process is out of scope.Not included: per-CLI memory scope (follow-up).
Verification
unit-oom-policy.test.ts(11 tests), including a fixture whosecatoutput has/etc/systemd/user/<unit>.d/10-admin.confwithOOMPolicy=kill(no write, no reload) and a failingcat(no write). All fail against 0265e95; all 11 pass at head.OOMPolicy=stopbefore,migrated,OOMPolicy=continueafter, unit stayed active, second call a no-op, onlydaemon-reloadran. /etc case (passwordless sudo):/etc/systemd/user/<unit>.d/10-admin.confwithOOMPolicy=kill, outcomealready-current, showkillbefore and after, no bb drop-in written, no commands. Everything removed afterwards (LoadState=not-found, no /etc leftovers, 8 other unit-dir files unchanged).pnpm exec turbo run typecheck test --filter=@bb/host-daemonon hsrpc-wsl: see PR comment.No issue: fork issues are disabled.