Summary
Observed a panic: send on closed channel in github.com/docker/buildx/util/progress.(*Printer).Write while running integration tests with the remote worker. This appears to be a lifecycle race where Write() can run after Wait() has closed p.status.
Reproduction
From the buildx repo:
# Narrow reproduction (remote worker)
TESTFLAGS=\"--run /TestBuildPolicyRemotePolicyFiles/worker=remote/remote-policy-no-local-fallback -v\" make test-integration
(See .github/CONTRIBUTING.md for running integration tests with a specific worker.)
Environment / versions
- BuildKit:
v0.28.1 (from CI job: test-integration (v0.28.1, remote, ./tests, experimental))
- Worker/driver:
remote
Stack trace
panic: send on closed channel
goroutine 109 [running]:
github.com/docker/buildx/util/progress.(*Printer).Write(0x25a72f19810, 0x25a72da3260)
github.com/docker/buildx/util/progress/printer.go:89 +0x4d
github.com/docker/buildx/util/progress.(*prefixed).Write(0x25a732337a0?, 0x25a72e6a3c0?)
github.com/docker/buildx/util/progress/multiwriter.go:32 +0x82
github.com/docker/buildx/util/progress.NewChannel.func1()
github.com/docker/buildx/util/progress/writer.go:73 +0x6a
created by github.com/docker/buildx/util/progress.NewChannel in goroutine 108
github.com/docker/buildx/util/progress/writer.go:54 +0xd3
Notes
In the failing run, the test TestIntegration/TestBuildPolicyRemotePolicyFiles/worker=remote/remote-policy-no-local-fallback was expecting an error message about a missing policy file, but the panic occurred while progress was still emitting status updates.
Ask
- Add a targeted regression test that exercises the lifecycle where
Write() can race with Wait() closing p.status.
- Fix the actual lifecycle race (ideally without making normal-operation progress writes lossy, except perhaps during shutdown).
Summary
Observed a
panic: send on closed channelingithub.com/docker/buildx/util/progress.(*Printer).Writewhile running integration tests with the remote worker. This appears to be a lifecycle race whereWrite()can run afterWait()has closedp.status.Reproduction
From the
buildxrepo:(See
.github/CONTRIBUTING.mdfor running integration tests with a specific worker.)Environment / versions
v0.28.1(from CI job:test-integration (v0.28.1, remote, ./tests, experimental))remoteStack trace
Notes
In the failing run, the test
TestIntegration/TestBuildPolicyRemotePolicyFiles/worker=remote/remote-policy-no-local-fallbackwas expecting an error message about a missing policy file, but the panic occurred while progress was still emitting status updates.Ask
Write()can race withWait()closingp.status.