Repository navigation
Conversation
sipsma
force-pushed
the
sipsma/engine-cgroup-controllers-race
branch
from
October 30, 2026 01:15
067beb2 to
ccbb61f
Compare
…e root The entrypoint moves every process out of the root cgroup, then enables the controllers for its children. A process that joins the root cgroup between the two makes the write fail with EBUSY. A client connecting through "docker exec" while the engine starts does exactly that: runc puts the exec in the container's root cgroup while no controllers are enabled there. The write was done by busybox sed, which exits 0 without a message when its write fails, so the engine started without the controllers. Every later "docker exec" then also landed in the root cgroup, keeping it busy for the engine's whole life, and crun, failing to enable the controllers at each container start, retried 1000 times with a 1 ms sleep: about a second per container. A cold build of dagger's CLI took ~155 s instead of ~27 s. Retry the move and the write, as e2e/helm/k3s-entrypoint.sh and moby's dind do, with echo, which reports a failed write, and stop the engine with diagnostics after 10 attempts. TestEngine/TestExecCgroupControllers gains a case that starts a process in the root cgroup right after the entrypoint's first read of its processes, through a cat wrapper, and keeps it there, as a connected client's exec stays. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/engine-cgroup-controllers-race
branch
from
October 30, 2026 20:53
ccbb61f to
a7fdf6d
Compare
Contributor
Author
|
Its commits moved into #15007, which now combines the engine's pending performance changes, to save CI runs. |
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.
The engine's entrypoint moves every process out of the container's root cgroup, then enables the cgroup controllers for its children. A process that joins the root cgroup in between makes that write fail with EBUSY. A CLI connecting through
docker execwhile the engine starts does exactly that: runc puts the exec in the container's root cgroup. busyboxsed, which did the write, exits 0 without a message when its write fails, so the engine started without the controllers.From then on, every
docker execalso landed in the root cgroup and kept it busy for the engine's whole life. crun, failing to enable the controllers at each container start, retried 1000 times with a 1 ms sleep: about 1.1 s per container. A cold build of dagger's CLI starts about 1,400 containers and took ~155 s instead of ~27 s. In our runs, this happened in between 1 in 200 and 6 in 100 cold starts, depending on the setup.The entrypoint now retries the move and the write, as moby's dind and
e2e/helm/k3s-entrypoint.shdo, withecho, which reports a failed write. After 10 attempts 0.1 s apart, it prints diagnostics and the engine exits. So if the controllers can never be enabled, the engine now fails to start instead of starting without them.TestEngine/TestExecCgroupControllersgains a case that starts a process in the root cgroup right after the entrypoint first reads its processes, and keeps it there, as a connected client does. The case fails with the old entrypoint and passes with this one. In 200 cold starts alternating the two entrypoints, the first build took 26.40 s with the old one and 26.42 s with the new one. The new one retried once and succeeded on its second attempt. No run stalled.