Skip to content

panic: send on closed channel in util/progress Printer during remote integration tests #3875

@lohitkolluri

Description

@lohitkolluri

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions