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

Document if kubeclient / restclient is threadsafe or not #419

Open
grosser opened this issue Sep 9, 2019 · 4 comments
Open

Document if kubeclient / restclient is threadsafe or not #419

grosser opened this issue Sep 9, 2019 · 4 comments

Comments

@grosser
Copy link
Contributor

grosser commented Sep 9, 2019

Would be nice to have a "Not threadsafe, use one kubeclient per Thread" or the opposite in the docs somewhere.

@cben
Copy link
Collaborator

cben commented Sep 9, 2019

I suspect it is but don't know for sure.

  • is rest-client thread-safe?
  • is http gem thread-safe?
  • I think the only Client mutation during use is lazy discovery. Is it safe?
  • is Config thread-safe?

@grosser
Copy link
Contributor Author

grosser commented Sep 9, 2019

yeah, client mutation is not threadsafe, I already run into that one :D

@cben
Copy link
Collaborator

cben commented Dec 16, 2019

I think we want it to become thread-safe. That's the only sane contract for a high-level library...

Do you know details on problems you saw?
Should discovery take a mutex, or would that risk one slow request blocking everything?
Should we let multiple parallel discovery requests to "race", but make sure the results are "committed atomically"? (I'd rather not, premature buggization...)

@grosser
Copy link
Contributor Author

grosser commented Dec 20, 2019

having an instance-mutex around discoveries should be cheap and make it threadsafe
alternative would be to initialize it with 'threadsafe: true' and then just eager-discover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants