progress: avoid panic when closing printer#3873
Conversation
Guard progress status writes during shutdown to prevent send-on-closed-channel panics observed in remote integration tests. Signed-off-by: Lohit Kolluri <lohitkolluri@gmail.com>
crazy-max
left a comment
There was a problem hiding this comment.
Thanks for the patch. Before changing the Printer write semantics, can you open an issue with a current reproduction and link it here?
Right now this PR doesn't show the lifecycle that can call Write after Wait has closed p.status, and there is no regression test. The only matching report I found is #1176, which is from 2022 and was closed as stale/possibly SIGTERM-related.
This patch also changes more than shutdown behavior: Write becomes best-effort and can drop progress updates whenever the buffer is full, not only while closing. That can lose logs/status/warnings during normal operation.
If this panic is still reproducible, please include the command, buildx/BuildKit versions, progress mode, a minimized Dockerfile or bake file if possible, and the full stack trace. Then we can add a targeted failing test and fix the actual lifecycle race rather than making all progress writes lossy.
|
Opened an issue with a current reproduction + full stack trace here: #3875 It reproduces in CI under Next step on my side: add a targeted regression test for that specific lifecycle and adjust the shutdown/lifecycle handling, rather than making all progress writes lossy in normal operation. |
|
Linking for tracking: #3875 |
Summary
send on closed channelpanics in progressPrintershutdown paths by making status writes best-effort during close.Test plan
go test ./util/progress -short