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

[23.0 backport] Lock container when deleting its root directory #47110

Merged

Conversation

corhere
Copy link
Contributor

@corhere corhere commented Jan 18, 2024

- What I did
The test TestDockerCLIRunSuite/TestRunContainerWithRmFlagCannotStartContainer has been flaky in CI recently. The daemon logs reveal the smoking gun:

can't remove container b7a3f785a0e7d4c93a41f792486c270f68d6b32e5530f45fa4f5b9f4b90deae5: unable to remove filesystem for b7a3f785a0e7d4c93a41f792486c270f68d6b32e5530f45fa4f5b9f4b90deae5: remove C:\Users\runneradmin\AppData\Local\Temp\moby-root\containers\b7a3f785a0e7d4c93a41f792486c270f68d6b32e5530f45fa4f5b9f4b90deae5.tmp-config.v2.json3263351271: The process cannot access the file because it is being used by another process.

Fix the test by cherry-picking a fix to make container deletion more reliable on Windows.

- How I did it

Attempting to delete the directory while another goroutine is concurrently executing a CheckpointTo() can fail on Windows due to file locking. As all callers of CheckpointTo() are required to hold the container lock, holding the lock while deleting the directory ensures that there will be no interference.

- How to verify it
Ci is ✅

- Description for the changelog

  • Improved the reliability of container deletion on Windows

- A picture of a cute animal (not mandatory but encouraged)

Attempting to delete the directory while another goroutine is
concurrently executing a CheckpointTo() can fail on Windows due to file
locking. As all callers of CheckpointTo() are required to hold the
container lock, holding the lock while deleting the directory ensures
that there will be no interference.

Signed-off-by: Cory Snider <csnider@mirantis.com>
(cherry picked from commit 18e322b)
Signed-off-by: Cory Snider <csnider@mirantis.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit 190138d into moby:23.0 Jan 19, 2024
87 checks passed
@corhere corhere modified the milestones: 23.0.9, 23.0.10 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants