From 31b76d0afcd67a202dad51363160fa99829cf5fe Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 9 Oct 2026 12:01:05 +0200 Subject: [PATCH] buckconfig: run the daemon in its own cgroup Buck runs the daemon and every local action in the cgroup of the shell that started it. Buck therefore cannot measure how much memory an action used, and it cannot kill processes that an action leaves running. Turn on resource control. The daemon then starts in a systemd user scope and runs each action in its own cgroup. `tine init` copies the section, so projects get it too. When memory runs out during a build, Buck keeps every local action running. systemd-oomd or the kernel OOM killer can then kill the daemon, and the build fails. Turn on suspension, so that Buck freezes the newest actions when memory pressure rises and thaws them once it drops. Signed-off-by: Daan De Meyer --- .buckconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.buckconfig b/.buckconfig index 743ee4f3..e1e123db 100644 --- a/.buckconfig +++ b/.buckconfig @@ -36,3 +36,11 @@ sqlite_materializer_state = true # Persist the dep-file cache too, so local actions still hit it after a daemon restart. sqlite_dep_file_state = true defer_write_actions = true + +[buck2_resource_control] +# A host without a systemd user manager, such as a container, runs the daemon without cgroups. +status = if_available +enable_suspension = true +# Killing a suspended action throws away its work, and a long action such as an RPM build then starts +# over. A frozen action keeps its work, but the kernel frees its memory only by swapping it out. +preferred_action_suspend_strategy = cgroup_freeze