daemon: bound startup goroutine creation - #52709
Open
Komzpa wants to merge 1 commit into
Open
Conversation
vvoland
reviewed
May 27, 2026
thaJeztah
reviewed
May 27, 2026
Komzpa
force-pushed
the
fixer-startup-goroutine-bound
branch
2 times, most recently
from
May 27, 2026 20:28
9d64af8 to
e9066fd
Compare
vvoland
reviewed
Jun 2, 2026
vvoland
requested changes
Jun 10, 2026
Komzpa
force-pushed
the
fixer-startup-goroutine-bound
branch
from
June 11, 2026 01:23
e9066fd to
10118cd
Compare
thaJeztah
reviewed
Jun 11, 2026
Signed-off-by: Darafei Praliaskouski <[email protected]>
Komzpa
force-pushed
the
fixer-startup-goroutine-bound
branch
from
June 29, 2026 08:42
10118cd to
b1f0c8d
Compare
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.
Summary
Follow-up to #38301: make the existing startup semaphore bound goroutine creation as well as active startup work.
Several daemon startup phases currently start one goroutine per container and acquire the startup semaphore inside each goroutine. With many containers, that still allows an unbounded number of goroutines to sit behind the semaphore.
This acquires the existing semaphore before starting each worker goroutine at the affected startup phases while preserving the existing
adjustParallelLimit(len(...), 128*runtime.NumCPU())policy. If the semaphore cannot be acquired, startup paths now return that error instead of silently skipping work. The swarm restart path cannot return an error, so it logs the acquire failure and stops scheduling more restart work.The registration pass no longer mutates the iterated
containersmap from worker goroutines: failed registrations are collected under the existing lock and removed from the map aftergroup.Wait(). The container restore pass usesgroup.Gofor consistency/readability. The container restart phase is left on the old shape because it has notifier dependencies between restarting containers.Release notes (optional)
Validation
gofmt -w daemon/daemon.gogit diff --checkgo test -tags 'netgo journald no_libnftables' ./daemon -run '^$' -count=1go test -tags 'netgo journald no_libnftables' ./daemon -count=1timed out after 10m in existingTestIfaceAddrs/Multiplewhile waiting onnetnsutils.SetupTestOSContextEx; this is unrelated to the startup semaphore changes.no_libnftableswas used because this local environment does not havelibnftables.pcinstalled; without that tag the daemon package fails during cgo pkg-config discovery before reaching these tests.Created with: Codex