Skip to content

daemon: bound startup goroutine creation - #52709

Open
Komzpa wants to merge 1 commit into
moby:masterfrom
Komzpa:fixer-startup-goroutine-bound
Open

daemon: bound startup goroutine creation#52709
Komzpa wants to merge 1 commit into
moby:masterfrom
Komzpa:fixer-startup-goroutine-bound

Conversation

@Komzpa

@Komzpa Komzpa commented May 27, 2026

Copy link
Copy Markdown
Contributor

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 containers map from worker goroutines: failed registrations are collected under the existing lock and removed from the map after group.Wait(). The container restore pass uses group.Go for 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.go
  • git diff --check
  • go test -tags 'netgo journald no_libnftables' ./daemon -run '^$' -count=1
  • go test -tags 'netgo journald no_libnftables' ./daemon -count=1 timed out after 10m in existing TestIfaceAddrs/Multiple while waiting on netnsutils.SetupTestOSContextEx; this is unrelated to the startup semaphore changes.

no_libnftables was used because this local environment does not have libnftables.pc installed; without that tag the daemon package fails during cgo pkg-config discovery before reaching these tests.

Created with: Codex

@github-actions github-actions Bot added the area/daemon Core Engine label May 27, 2026
Comment thread daemon/daemon.go Outdated
@vvoland vvoland added this to the 29.6.0 milestone May 27, 2026
Comment thread daemon/daemon.go
@Komzpa
Komzpa force-pushed the fixer-startup-goroutine-bound branch 2 times, most recently from 9d64af8 to e9066fd Compare May 27, 2026 20:28
@vvoland vvoland added the kind/bugfix PR's that fix bugs label May 28, 2026
Comment thread daemon/daemon_test.go Outdated
Comment thread daemon/daemon.go Outdated
@thaJeztah thaJeztah modified the milestones: 29.6.0, 29.6.1 Jun 10, 2026
@Komzpa
Komzpa force-pushed the fixer-startup-goroutine-bound branch from e9066fd to 10118cd Compare June 11, 2026 01:23
Comment thread daemon/daemon.go Outdated
@thaJeztah thaJeztah modified the milestones: 29.6.1, 29.7.0 Jun 18, 2026
Signed-off-by: Darafei Praliaskouski <[email protected]>
@Komzpa
Komzpa force-pushed the fixer-startup-goroutine-bound branch from 10118cd to b1f0c8d Compare June 29, 2026 08:42
@vvoland vvoland modified the milestones: 29.7.0, 29.8.0 Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine kind/bugfix PR's that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants