Skip to content

[FIX]: tentatively fix concurrent access to locked CNI directory (#3783) - #4165

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
apostasie:fix-2025-04-locking
Apr 27, 2025
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
apostasie:fix-2025-04-locking

Conversation

@apostasie

@apostasie apostasie commented Apr 25, 2025 •

Copy link
Copy Markdown
Contributor

See #3783 for discussion.

TL;DR: based on investigation above, the hypothesis is that other systems may add locks over the CNI directory.
Since we do as well, this seem to deadlock Cilium.

This patch is moving our lock for CNIEnv to a sub-directory (which appears to be the least disruptive option - see unhappy comment below :-) ), which should allow Cilium (and others) to go through.

HOWEVER:

  • I believe this is a shortcoming of CNI plugins in the first place (ie: that they are enumerating the filesystem without locking), and we should not have to do that ourselves
  • it is unclear to me if that will really fix the issue with Cilium, or if it is going to create more (as in: since we no longer prevent concurrent access, what will happen if both Cilium and nerdctl touch the same resources, ignoring each other lock?)

Nevertheless, it feels like the investigation in #3783 is conclusive enough, and this should only enhance the situation at worse (even if it does not fix everything).

Suggesting we consider for inclusion in 2.0.5.

@apostasie apostasie changed the title Tentatively fix #3783 Tentatively fix concurrent access to locked CNI directory (#3783) Apr 25, 2025
@apostasie apostasie changed the title Tentatively fix concurrent access to locked CNI directory (#3783) [FIX]: tentatively fix concurrent access to locked CNI directory (#3783) Apr 25, 2025
@apostasie
apostasie force-pushed the fix-2025-04-locking branch 2 times, most recently from cdb61a0 to c6e182d Compare April 25, 2025 22:37
@apostasie

Copy link
Copy Markdown
Contributor Author

Geez...
I hate this already.

@apostasie

apostasie commented Apr 25, 2025 •

Copy link
Copy Markdown
Contributor Author
  • globally putting lock files inside the directories is going to fuckup store implementations that will now see extra stuff in their directory (and also leak files, see below)
  • globally adding sidecar lock files (or directories) alongside the directory will leak as we cannot safely remove them without overly complicating all this, which is currently breaking tests (and well, is bad because creating leftover files plenty)
  • locking out of tree will have the same problem
  • addressing the issue just for cnienv and creating a file inside the cniconfpath makes everything yell at us for finding unexpected resources under that directory

(╯°□°)╯︵ ┻━┻

@apostasie
apostasie force-pushed the fix-2025-04-locking branch 5 times, most recently from f504964 to 9595514 Compare April 26, 2025 00:34
@apostasie apostasie closed this Apr 26, 2025
@apostasie apostasie reopened this Apr 26, 2025
@apostasie
apostasie force-pushed the fix-2025-04-locking branch from 9595514 to 7e41456 Compare April 26, 2025 01:02
@apostasie
apostasie marked this pull request as ready for review April 26, 2025 02:23
@AkihiroSuda AkihiroSuda added this to the v2.0.5 milestone Apr 27, 2025

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda
AkihiroSuda merged commit 14d6355 into containerd:main Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants