swarm_runner: the runner-unit fence (MemoryHigh=2G/MemoryMax=3G) overrides the raised 6G/8G and thrashes two concurrent jobs into swap on elitebook-03 #20

Open
opened 2026-09-25 14:03:51 +00:00 by ben · 1 comment
Owner

What happened (2026-09-25, elitebook-distributed-server-03)

idss release-publish (the run for idss #1880, 4378a9ff) sat on the dashboard's vue-tsc type-check for more than 35 minutes. That step normally takes about 2 minutes. At the time:

  • Load was 43 on 8 CPUs, with 91% of CPU time in I/O wait and 41 processes stuck waiting on disk (D state).
  • Swap was completely full (4 GB of 4 GB). The host itself still had about 11 GB available.
  • The runner unit's cgroup was at memory.current 2.15 GB against memory.high 2 GB, with 2.5 GB of it in swap. memory.events counted high 224,558,957 times and max 2,421 times.

capacity: 2 put two jobs in that cgroup at once, the release publish and main's CI (vitest with 8 workers). Both run on the host executor, so both share the runner unit's fence, and the kernel throttled them into swap thrash.

Cause: the raised limit is silently overridden

The runner unit has two conflicting memory settings:

  • /etc/systemd/system.control/forgejo-runner-swarm.service.d/50-MemoryHigh.conf sets MemoryHigh=6G, and 50-MemoryMax.conf sets MemoryMax=8G. Someone ran systemctl set-property to raise the limit.
  • /etc/systemd/system/forgejo-runner-swarm.service.d/50-swarm-fence.conf, written by this repo's roles/swarm_runner/templates/runner-service-fence.conf.j2, sets MemoryHigh=2G and MemoryMax=3G.

Drop-ins apply in filename order, and 50-swarm-fence.conf sorts after 50-Memory*.conf, so the Ansible fence wins. The 2G/3G sizing came from "observed steady-state ~1.1G mid-run", measured for a single job. The runner now takes two jobs at a time, and the dashboard type-check plus vitest need more than 2 GB between them.

A systemctl set-property --runtime fix loses the same way: its file (/run/systemd/system.control/…/50-MemoryHigh.conf) also sorts before the fence file. Today's unblock wrote the live cgroup directly (memory.high 6G, memory.max 8G); that reverts on the unit's next restart.

Fix

  • In runner-service-fence.conf.j2, raise the fence to MemoryHigh=6G and MemoryMax=8G, the values the manual change was aiming for. Or size it per job (capacity × about 3 GB). Keep the etcd voter protection that D3 intends: the host has about 15 GB.
  • Update the set-property --runtime hint in tasks/main.yml:170 to match.
  • After the play runs, remove the stale /etc/systemd/system.control/…/50-Memory*.conf drop-ins so there is one source of truth.
  • Consider freeing the 4 GB swap: it was already full before this run. See the earlier /tmp tmpfs residue history on this host (idss #1207).
  • matou-dev-server-01: runner unfenced, load 1.3, fine. But / is 96% full.
  • mail (100.98.48.68): fine.
  • build-host-01 and bens-mac-04: unreachable at check time.

🤖 Generated with Claude Code

## What happened (2026-09-25, elitebook-distributed-server-03) idss release-publish (the run for idss #1880, `4378a9ff`) sat on the dashboard's `vue-tsc` type-check for more than 35 minutes. That step normally takes about 2 minutes. At the time: - Load was 43 on 8 CPUs, with 91% of CPU time in I/O wait and 41 processes stuck waiting on disk (`D` state). - Swap was completely full (4 GB of 4 GB). The host itself still had about 11 GB available. - The runner unit's cgroup was at `memory.current` 2.15 GB against `memory.high` 2 GB, with 2.5 GB of it in swap. `memory.events` counted `high` 224,558,957 times and `max` 2,421 times. `capacity: 2` put two jobs in that cgroup at once, the release publish and main's CI (vitest with 8 workers). Both run on the host executor, so both share the runner unit's fence, and the kernel throttled them into swap thrash. ## Cause: the raised limit is silently overridden The runner unit has two conflicting memory settings: - `/etc/systemd/system.control/forgejo-runner-swarm.service.d/50-MemoryHigh.conf` sets `MemoryHigh=6G`, and `50-MemoryMax.conf` sets `MemoryMax=8G`. Someone ran `systemctl set-property` to raise the limit. - `/etc/systemd/system/forgejo-runner-swarm.service.d/50-swarm-fence.conf`, written by this repo's `roles/swarm_runner/templates/runner-service-fence.conf.j2`, sets `MemoryHigh=2G` and `MemoryMax=3G`. Drop-ins apply in filename order, and `50-swarm-fence.conf` sorts after `50-Memory*.conf`, so the Ansible fence wins. The 2G/3G sizing came from "observed steady-state ~1.1G mid-run", measured for a single job. The runner now takes two jobs at a time, and the dashboard type-check plus vitest need more than 2 GB between them. A `systemctl set-property --runtime` fix loses the same way: its file (`/run/systemd/system.control/…/50-MemoryHigh.conf`) also sorts before the fence file. Today's unblock wrote the live cgroup directly (`memory.high` 6G, `memory.max` 8G); that reverts on the unit's next restart. ## Fix - In `runner-service-fence.conf.j2`, raise the fence to `MemoryHigh=6G` and `MemoryMax=8G`, the values the manual change was aiming for. Or size it per job (`capacity` × about 3 GB). Keep the etcd voter protection that D3 intends: the host has about 15 GB. - Update the `set-property --runtime` hint in `tasks/main.yml:170` to match. - After the play runs, remove the stale `/etc/systemd/system.control/…/50-Memory*.conf` drop-ins so there is one source of truth. - Consider freeing the 4 GB swap: it was already full before this run. See the earlier /tmp tmpfs residue history on this host (idss #1207). ## Related hosts checked the same day - matou-dev-server-01: runner unfenced, load 1.3, fine. But `/` is **96% full**. - mail (100.98.48.68): fine. - build-host-01 and bens-mac-04: unreachable at check time. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

2026-09-25 14:25Z: unblocked by hand.

  • Runner cgroup: memory.high=6G and memory.max=8G, written directly through ian sudo. This reverts on the next restart; this ticket makes it permanent.
  • /tmp cleaned: 3.1 GB → 844 MB. The runner's swap use fell from 3.5 GB to 1.17 GB of 4 GB.
    • Swarm-owned entries older than a day were removed, skipping any that a process had open.
    • /tmp/matou-test-backend.log (1.8 GB) was emptied rather than removed. Its writer, /home/swarm/swarm-e2e/Matou/matou-app/backend/bin/server, was about 5 hours old and still writing DEBUG sync lines. It is either a live matou-app e2e run or a leaked one (the matou-app#331 class). It was not killed; whoever owns swarm-e2e should check it.

The cancelled idss release-publish (30-min timeout, thrashed) was re-dispatched and published 4378a9ff (seq 2910).

2026-09-25 14:25Z: unblocked by hand. - **Runner cgroup:** `memory.high`=6G and `memory.max`=8G, written directly through `ian` sudo. This reverts on the next restart; this ticket makes it permanent. - **`/tmp` cleaned:** 3.1 GB → 844 MB. The runner's swap use fell from 3.5 GB to 1.17 GB of 4 GB. - Swarm-owned entries older than a day were removed, skipping any that a process had open. - `/tmp/matou-test-backend.log` (1.8 GB) was emptied rather than removed. Its writer, `/home/swarm/swarm-e2e/Matou/matou-app/backend/bin/server`, was about 5 hours old and still writing DEBUG sync lines. It is either a live matou-app e2e run or a leaked one (the matou-app#331 class). It was **not** killed; whoever owns swarm-e2e should check it. The cancelled idss release-publish (30-min timeout, thrashed) was re-dispatched and published `4378a9ff` (seq 2910).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/matou-distributed-servers#20
No description provided.