fix: propagate download errors through StartDockerImageDownload join function - #48487
Merged
Conversation
- Add inflightDownload struct with done channel and err field - Change StartDockerImageDownload return type to (bool, func() error) - Fix defer ordering in goroutine: recover+set-error first, cleanup second, close-done last (callers only unblock after dl.err is set) - Propagate download errors through dl.err field set before done closes - Update concurrent tests to collect and join goroutines to prevent leaks - Update README.md with correct function signature - Fix pre-existing smoke-copilot-auto.lock.yml drift Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix goroutine leak in StartDockerImagePull
fix: propagate download errors through StartDockerImageDownload join function
Jul 28, 2026
pelikhan
marked this pull request as ready for review
July 28, 2026 02:45
Contributor
There was a problem hiding this comment.
Pull request overview
Adds error propagation to Docker image download join functions and improves test cleanup.
Changes:
- Stores completion errors alongside in-flight downloads.
- Updates concurrent tests to cancel and join downloads.
- Corrects public API documentation.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/docker_images.go |
Adds error-returning joins and panic handling |
pkg/cli/docker_images_test.go |
Joins concurrent test downloads |
pkg/cli/docker_images_test_helpers_test.go |
Updates in-flight state initialization |
pkg/cli/README.md |
Corrects Docker API signatures |
.github/workflows/smoke-copilot-auto.lock.yml |
Removes generated model-cost metadata |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Medium
Comment on lines
+176
to
+177
| // Defer order (LIFO): recover+set-error runs first, cleanup runs second, | ||
| // close(done) runs last so callers only unblock after dl.err is set. |
| lastErr = fmt.Errorf("panic in docker image download for %s: %v", image, r) | ||
| dockerImagesLog.Printf("Panic in docker image download for %s (recovered): %v", image, r) | ||
| } | ||
| dl.err = lastErr |
Comment on lines
+248
to
+250
| return true, func() error { | ||
| <-dl.done | ||
| return dl.err |
Collaborator
|
@copilot resolve the merge conflicts on this branch. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot stopped work on behalf of
pelikhan due to an error
July 28, 2026 03:08
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
StartDockerImageDownloadreturned afunc()join that blocked but discarded all errors, giving callers no way to detect pull failures. The defer ordering inside the goroutine also ranrecover()after map cleanup, so a panic during cleanup would escape unrecovered.Changes
pkg/cli/docker_images.goinflightDownloadstruct (done chan struct{}+err error) replacing the rawchan struct{}in theinflightmap(bool, func())→(bool, func() error); the join function now returns any download error after the goroutine exitsrecover+set-error→ map cleanup →close(done), ensuringdl.erris always written before callers unblockpkg/cli/docker_images_test.goTestStartDockerImageDownload_ConcurrentCallsandTestStartDockerImageDownload_RaceWithExternalDownloadto collect all join functions and cancel the context at cleanup, eliminating goroutine leaks detected by goleakpkg/cli/docker_images_test_helpers_test.goResetDockerPullStateupdated to initializemap[string]*inflightDownloadpkg/cli/README.mdStartDockerImageDownloadandCheckAndPrepareDockerImagessignatures in the public API table