Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: properly handle "error reading image pull progress" #24981

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gulducat
Copy link
Member

@gulducat gulducat commented Jan 30, 2025

Description

With the docker driver, if an error is encountered while reading image pull progress, the allocation gets stuck pending.

This happens because dockerCoordinator.PullImage() gets deadlocked at future.wait(), because this one error path (introduced here in v1.9.0) does not do a future.set() to close the channel that future.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 If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    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

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.

@gulducat gulducat requested review from a team as code owners January 30, 2025 20:32
set() on the future, so the caller can handle it
instead of wait()ing forever and causing the
allocation to get stuck "pending"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nomad allocation stuck in pending state after docker "error reading image pull progress"
1 participant