You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
Currently, there is no file locking mechanism when writing CLI config ~/.config/tanzu/config.yaml. This means multiple processes/plugins interacting with the CLI can issue commands that result in concurrent writes. This can get the config file into a bad state.
We've seen this issue a few times in internal tests where the config ended up looking like this (an invalid YAML):
It appears that we are updating the config during a get operation. A config get ideally shouldn't do a write, so we need find a different place to do those updates and let multiple processes read concurrently (with something like an RWLock).
There are probably some libraries in Go that lets us do file locking. There was also a proposal to make it part of the standard library, but it appears to be incomplete.
Affected product area (please put an X in all that apply)
APIs
Addons
CLI
Docs
IAM
Installation
Plugin
Security
Test and Release
User Experience
Expected behavior
Config writes should be concurrency-safe.
Steps to reproduce the bug
Version (include the SHA if the version is not obvious)
Environment where the bug was observed (cloud, OS, etc)
Relevant Debug Output (Logs, manifests, etc)
The text was updated successfully, but these errors were encountered:
Thanks for posting the issues and providing the details.
I think item 2 is definitely necessary.
Item 1 as well, but just want to note even after addressing it, but depending how the file locking is done, it is likely we will still need some form of locking when reading the config as well.
We can use this implementation to add lock to tanzu configuration as well needed specially when reading the tanzu config file update purpose. We might not need the lock when just reading the tanzu configuration.
Bug description
Currently, there is no file locking mechanism when writing CLI config
~/.config/tanzu/config.yaml
. This means multiple processes/plugins interacting with the CLI can issue commands that result in concurrent writes. This can get the config file into a bad state.We've seen this issue a few times in internal tests where the config ended up looking like this (an invalid YAML):
To avoid this, we can do two things:
There are probably some libraries in Go that lets us do file locking. There was also a proposal to make it part of the standard library, but it appears to be incomplete.
Affected product area (please put an X in all that apply)
Expected behavior
Config writes should be concurrency-safe.
Steps to reproduce the bug
Version (include the SHA if the version is not obvious)
Environment where the bug was observed (cloud, OS, etc)
Relevant Debug Output (Logs, manifests, etc)
The text was updated successfully, but these errors were encountered: