docker: properly handle "error reading image pull progress" #24981
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.
Description
With the
docker
driver, if an error is encountered while reading image pull progress, the allocation gets stuckpending
.This happens because
dockerCoordinator.PullImage()
gets deadlocked atfuture.wait()
, because this one error path (introduced here in v1.9.0) does not do afuture.set()
to close the channel thatfuture.wait()
blocks on.Worse, the whole
TaskRunner.Run()
goroutine from the allocrunner remains stuck until the client is forcibly restarted (it can not shut down gracefully). This same bug could be introduced again in the future by mistake, but since the error path fixed in this PR is the only one (that I know of) that does it today, addressing the broader problem to protect against potential regression will be addressed in a separate PR (edit: this one: #24992).Testing & Reproduction steps
Reporter encountered this when there was an issue with their image repository. I reproduced it by changing the source to always hit the relevant error path, and without the fix commit, the new test deadlocks (this isn't great even for a test, but as I said, a problem for another PR).
Links
Fixes #24955
Contributor Checklist
changelog entry using the
make cl
command.ensure regressions will be caught.
and job configuration, please update the Nomad website documentation to reflect this. Refer to
the website README for docs guidelines. Please also consider whether the
change requires notes within the upgrade guide.
Reviewer Checklist
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.