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

Move config lock check to _load_config #1642

Merged
merged 3 commits into from
Jun 3, 2022
Merged

Move config lock check to _load_config #1642

merged 3 commits into from
Jun 3, 2022

Conversation

bewing
Copy link
Member

@bewing bewing commented May 20, 2022

The config lock should always be checked whenever we create a new
configuration session, as we waste compute resources otherwise. If two
NAPALM threads create a session, both will fail to commit with the
current order of operations -- moving the check to session creation
means the first one to obtain the lock will be able to commit.

The config lock should always be checked whenever we create a new
configuration session, as we waste compute resources otherwise.  If two
NAPALM threads create a session, both will fail to commit with the
current order of operations -- moving the check to session creation
means the first one to obtain the lock will be able to commit.
@bewing
Copy link
Member Author

bewing commented May 20, 2022

Partial reversion of #1042 by @blahu

@bewing
Copy link
Member Author

bewing commented May 20, 2022

Copy of my comments from slack:

EOS implements sessions in such a way that if you have two open sessions, it's very likely the last one to commit will overwrite the changes from the first.
I was thinking about a workflow where you look at the config, mutate a section of the config, and then commit it back -- there's a race between the first RPC call where I get the config, and the second RPC call where I open the config session with load_merge_candidate
A workaround for this is to just call load_merge_candidate(config=[]) prior to getting the running config to mutate. However, the downside of this is now you could be wasting compute time needlessly. If, for example, I have an extremely low-bandwidth connection to the device, or have to do very heavy computation, it's possible for multiple threads/processes to lock/grab config, as we won't check for locks until the commit. Makes more sense to keep _lock() in _load_config rather than commit_config to me. Thoughts?

@bewing bewing self-assigned this May 20, 2022
@bewing bewing requested a review from ktbyers May 20, 2022 21:40
Copy link
Member

@mirceaulinic mirceaulinic left a comment

Choose a reason for hiding this comment

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

Make sense!

@mirceaulinic mirceaulinic added this to the 4.0.0 milestone May 21, 2022
@mirceaulinic mirceaulinic merged commit c4673bb into develop Jun 3, 2022
@mirceaulinic mirceaulinic deleted the eos_lock_move branch June 3, 2022 08:13
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.

2 participants