Skip to content

docker-container: give readiness wait a full startup timeout - #4050

Merged
crazy-max merged 2 commits into
docker:masterfrom
crazy-max:fix-docker-container-readiness-wait
Sep 10, 2026
Merged

docker-container: give readiness wait a full startup timeout#4050
crazy-max merged 2 commits into
docker:masterfrom
crazy-max:fix-docker-container-readiness-wait

Conversation

@crazy-max

Copy link
Copy Markdown
Member

relates to https://github.com/docker/buildx/actions/runs/33654939933/job/100331039441#step:7:2387

=== Failed
=== FAIL: tests TestIntegration/TestBuildPolicyImageName/worker=docker-container/config-label-allow (0.07s)
    policy_build.go:579:
        	Error Trace:	/src/tests/policy_build.go:579
        	Error:      	Received unexpected error:
        	            	exit status 1
        	Test:       	TestIntegration/TestBuildPolicyImageName/worker=docker-container/config-label-allow
        	Messages:   	ERROR: failed to build: waiting for BuildKit: DeadlineExceeded: context deadline exceeded while waiting for connections to become ready
        --- FAIL: TestIntegration/TestBuildPolicyImageName/worker=docker-container/config-label-allow (0.07s)

A recently started builder should use its StartedAt timestamp to decide whether BuildKit may still be coming up, but not as the absolute deadline for the client readiness wait.

When the first client request arrived near the end of that startup window, the wait could inherit only a few milliseconds and fail with DeadlineExceeded even though the builder was still legitimately starting. Give those recent containers a fresh bounded wait from the current time while continuing to skip the wait for established builders.

A recently started builder should use its StartedAt timestamp to decide whether BuildKit may
still be coming up, but not as the absolute deadline for the client readiness wait.

When the first client request arrived near the end of that startup window, the wait could inherit
only a few milliseconds and fail with DeadlineExceeded even though the builder was still
legitimately starting. Give those recent containers a fresh bounded wait from the current time
while continuing to skip the wait for established builders.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max

Copy link
Copy Markdown
Member Author

Encounter this error quite often in actions-toolkit integration tests: https://github.com/docker/actions-toolkit/actions/runs/34329830393/job/102395668163?pr=1309#step:10:752

/usr/bin/docker buildx history export --builder builder-6e45ead8-b127-4744-ac90-e183cea22f82 --output /home/runner/work/_temp/docker-actions-toolkit-I68wIX/export/***~71SJ0M.dockerbuild 71sj0ml6gjf0g90srl8bmo5b4 --finalize
Writing summary
 ❯ __tests__/github/summary.test.itg.ts (7 tests | 1 failed) 12100ms
     ✓ write build summary %p  3676ms
     ✓ write build summary %p  1548ms
     ✓ write bake summary %p  1240ms
     ✓ write bake summary %p  1452ms
     × write bake summary %p 2420ms
     ✓ fails with dockerfile syntax issue  1105ms
     ✓ without build record  656ms

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯

 FAIL  __tests__/github/summary.test.itg.ts > writeBuildSummary > write bake summary %p
Error: ERROR: waiting for BuildKit: DeadlineExceeded: context deadline exceeded while waiting for connections to become ready
 ❯ src/buildx/history.ts:66:15
     64|     }).then(res => {
     65|       if (res.stderr.length > 0 && res.exitCode != 0) {
     66|         throw new Error(res.stderr.trim());
       |               ^
     67|       }
     68|       return <InspectResponse>JSON.parse(res.stdout);
 ❯ History.inspect src/buildx/history.ts:61:12
 ❯ History.export src/buildx/history.ts:113:9
 ❯ __tests__/github/summary.test.itg.ts:157:23

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

Use the container start time only to decide whether readiness waiting is
needed. Start a full timeout immediately before waiting so Docker dial time
does not consume the readiness budget.

Name the startup window and readiness timeout independently, and cover the
exact startup-window boundary.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@crazy-max
crazy-max merged commit 27a5fea into docker:master Sep 10, 2026
162 checks passed
@crazy-max
crazy-max deleted the fix-docker-container-readiness-wait branch September 10, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants