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

commands: remove mutex from state client list #2189

Merged
merged 1 commit into from Feb 26, 2018

Conversation

brauner
Copy link
Member

@brauner brauner commented Feb 26, 2018

I was thinking about the locking here yesterday and it dawned on me that we
actually don't need this at all:

  • possible contention between traversing list to send states to state clients
    and adding new state clients to the list:
    It is the command handler that adds new state clients to the state client
    list. The command handler and the code that actually sends out the container
    states run in the same process so there's not contention and thus no locking
    needed.
  • adding state clients to the list from multiple threads:
    The command handler itself is single-threaded so only one thread's request can
    be served at the same time so no locking is needed.
  • sending out the state to state clients via the command handler itself:
    The state client also adds and removes state clients from the state client
    list so there's no locking needed.

Signed-off-by: Christian Brauner christian.brauner@ubuntu.com

I was thinking about the locking here yesterday and it dawned on me that we
actually don't need this at all:
- possible contention between traversing list to send states to state clients
  and adding new state clients to the list:
  It is the command handler that adds new state clients to the state client
  list. The command handler and the code that actually sends out the container
  states run in the same process so there's not contention and thus no locking
  needed.
- adding state clients to the list from multiple threads:
  The command handler itself is single-threaded so only one thread's request can
  be served at the same time so no locking is needed.
- sending out the state to state clients via the command handler itself:
  The state client also adds and removes state clients from the state client
  list so there's no locking needed.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
@stgraber stgraber merged commit d5bd4f0 into lxc:master Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants