You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pynixd: a builder that thrashes inside a capped cgroup reads as steady, because memory_full counts only under 25% host MemAvailable #1568
pressure.py_verdict counts PSI memory_full only while host MemAvailable is under 25% of MemTotal (memory_full_below_available, from #1260). A builder whose builds run in a capped cgroup thrashes inside the cap with the host far above 25% free, and pynixd reads it as steady and raises its limit.
Measured 2026-11-22 on sg1-n1/n2/n3 (125 GB each, ~57 GB available): nix-daemon.service has MemoryHigh=20G, memory.current 21.5 GB, its memory.pressure full avg10 62-82. pynixd state showed memory_full 63-83 with reason steady (n1, n3) or slow_start (n2), limits 8-32, 7-11 builds each. A cc1 on /dev/null in linux-config took 497 s of system time; builds of seconds waited 20+ minutes.
Fix direction: judge room against the cgroup the builds run in (memory.high/memory.max and memory.current of the daemon's unit), and read that cgroup's memory.pressure, not the host's /proc/meminfo. #1260's swap-in case stays covered if the room test uses the cgroup's own headroom.
The other half, from the nodes' owner (solid-kubernetes environments/sg1/nixos/modules/rs501a.nix): the 20G cap is deliberate. After an uncapped python3.14t-huggorm-bindings build (74 g++, ~2 GiB each) on sg1-n3 on 2026-11-20 15:03 UTC, the OOM killer took 60 pod processes and the node went NotReady. The cap is sized for the nodes' own cores = 8, max-jobs = 2.
pynixd places 7-11 builds per node: its build pool is 32 slots and its limit ceiling 32, while the node's daemon declares max-jobs = 2. So the fix has two parts: cap a store's builds at the remote daemon's max-jobs (or its declared slots), and treat the daemon cgroup's memory.pressure / memory.current near memory.high as saturation.
The thrash also starves the nodes' other tenants of disk. The node owner (solidk) measured on sg1-n1/n2/n3, 2026-11-22 ~14:20 CET, read-only, comparing cgroup io.stat over 10 s:
nix-daemon.service reads 530-730 MB/s per node and writes about 0; kubepods writes 1.5-13 MB/s.
workingset_refault_file in that cgroup is 1.0-2.7 billion pages: at the 20G memory.high it evicts compiler and header pages and reads them back.
Host PSI io full avg60 is 7-13%, so Ceph and the pods wait on the disk too.
Drive wear is fine (percentage_used 0%, media_errors 0).
Three causes, all fixed on main (a9a1ef2, c0e5049, 1154a24; locks 3832c18, 6765a8e). dynhetz runs them; the sg1 nodes wait on a pynixd bump (solidk, after its running kubeapply).
Measured on sg1-n1, 2026-11-22 13:00 UTC: builds run in nix-daemon.service/nix-build-uid-*. memory.current 21.5 GB against memory.high 20 GiB, anon 21.4 GB, file 13 MB, memory.pressure full avg10 59.85. There is no swap (MemorySwapMax=0), so reclaim drops code pages and the builds crawl.
Slots. A proxying reverse builder declared its CPU count (32 after the ceiling). It now registers its own Nix's max-jobs and cores (nix config show): 2 and 8 on sg1.
Cores (new). pynixd forwarded the client's cores = 0, which overrides the node's cores = 8, so each build had 48 CPUs. A declared cores is now a hard ceiling that pynixd always sends.
Room and pressure.pressure.build_cgroup (the NixOS module defaults it to the daemon's unit) makes each sample carry the tightest memory.high/max over that cgroup and its ancestors, the room under it (page cache counts as free, shmem does not), and its memory.pressure. The limit verdict, memory_room (core choice) and pynixd state read the merged room. memory_full is the larger of the cgroup's and the host's.
Other reverse builders: gx10-1759 declares max-jobs = 20, its current 20 slots. macbook (15 slots now) follows its own max-jobs once its pynixd updates; not checked.
Open until the nodes run it: dynhetz should show 2 build slots per sg1 node, available_mb at or under ~20000, and builds there should get NIX_BUILD_CORES=8.
Verified on all three nodes after solidk's rollout to 6765a8e (NixOSRollout rs501a, about 14:50 UTC). Read from dynhetz's pynixd state --section stores, 2026-11-22:
node
build slots
in use
available_mb
memory_full
sg1-n1
2
2
20311
0.0
sg1-n2
2
2
19964
0.0
sg1-n3
2
2
20251
0.0
Each node declares its Nix max-jobs (2). available_mb is the room under the 20 GiB cap of nix-daemon.service, not the host's 57 GB. Before the fix, sg1-n2 had 32 slots and memory_full 83. NIX_BUILD_CORES=8 was measured in running builds on sg1-n1. n2 and n3 run the same code.
Activity
Lillecarl commentedon Nov 22, 2026
The other half, from the nodes' owner (solid-kubernetes
environments/sg1/nixos/modules/rs501a.nix): the 20G cap is deliberate. After an uncappedpython3.14t-huggorm-bindingsbuild (74 g++, ~2 GiB each) on sg1-n3 on 2026-11-20 15:03 UTC, the OOM killer took 60 pod processes and the node went NotReady. The cap is sized for the nodes' owncores = 8,max-jobs = 2.pynixd places 7-11 builds per node: its build pool is 32 slots and its limit ceiling 32, while the node's daemon declares
max-jobs = 2. So the fix has two parts: cap a store's builds at the remote daemon'smax-jobs(or its declared slots), and treat the daemon cgroup'smemory.pressure/memory.currentnearmemory.highas saturation.Assisted-By: Claude Opus 5.5
Lillecarl commentedon Nov 22, 2026
The thrash also starves the nodes' other tenants of disk. The node owner (solidk) measured on sg1-n1/n2/n3, 2026-11-22 ~14:20 CET, read-only, comparing cgroup
io.statover 10 s:nix-daemon.servicereads 530-730 MB/s per node and writes about 0;kubepodswrites 1.5-13 MB/s.workingset_refault_filein that cgroup is 1.0-2.7 billion pages: at the 20Gmemory.highit evicts compiler and header pages and reads them back.iofull avg60 is 7-13%, so Ceph and the pods wait on the disk too.Assisted-By: Claude Opus 5.5
pynixd: a reverse builder declares its own Nix's max-jobs and cores
pynixd: judge a builder's memory by the cgroup its builds run in
flake.lock: pynixd at nixidae 3832c184
pynixd: count the host's memory stall beside the build cgroup's
flake.lock: pynixd at nixidae 6765a8ed
Lillecarl commentedon Nov 22, 2026
Three causes, all fixed on main (a9a1ef2, c0e5049, 1154a24; locks 3832c18, 6765a8e). dynhetz runs them; the sg1 nodes wait on a pynixd bump (solidk, after its running kubeapply).
Measured on sg1-n1, 2026-11-22 13:00 UTC: builds run in
nix-daemon.service/nix-build-uid-*.memory.current21.5 GB againstmemory.high20 GiB,anon21.4 GB,file13 MB,memory.pressurefull avg10 59.85. There is no swap (MemorySwapMax=0), so reclaim drops code pages and the builds crawl.max-jobsandcores(nix config show): 2 and 8 on sg1.cores = 0, which overrides the node'scores = 8, so each build had 48 CPUs. A declaredcoresis now a hard ceiling that pynixd always sends.pressure.build_cgroup(the NixOS module defaults it to the daemon's unit) makes each sample carry the tightestmemory.high/maxover that cgroup and its ancestors, the room under it (page cache counts as free, shmem does not), and itsmemory.pressure. The limit verdict,memory_room(core choice) andpynixd stateread the merged room.memory_fullis the larger of the cgroup's and the host's.Other reverse builders: gx10-1759 declares
max-jobs = 20, its current 20 slots. macbook (15 slots now) follows its ownmax-jobsonce its pynixd updates; not checked.Open until the nodes run it: dynhetz should show 2 build slots per sg1 node,
available_mbat or under ~20000, and builds there should getNIX_BUILD_CORES=8.Assisted-By: Claude Opus 5.5
Lillecarl commentedon Nov 22, 2026
Verified on all three nodes after solidk's rollout to 6765a8e (NixOSRollout rs501a, about 14:50 UTC). Read from dynhetz's
pynixd state --section stores, 2026-11-22:Each node declares its Nix
max-jobs(2).available_mbis the room under the 20 GiB cap ofnix-daemon.service, not the host's 57 GB. Before the fix, sg1-n2 had 32 slots and memory_full 83.NIX_BUILD_CORES=8was measured in running builds on sg1-n1. n2 and n3 run the same code.Assisted-By: Claude Opus 5.5