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

WSClient.update() fails on select.poll() when running in eventlet on Linux #1753

Closed
bobh66 opened this issue Mar 17, 2022 · 3 comments · Fixed by #1848
Closed

WSClient.update() fails on select.poll() when running in eventlet on Linux #1753

bobh66 opened this issue Mar 17, 2022 · 3 comments · Fixed by #1848
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@bobh66
Copy link
Contributor

bobh66 commented Mar 17, 2022

What happened (please include outputs or screenshots):

WSClient.update() was modified by PR kubernetes-client/python-base#268 to use select.poll() instead of select.select, which breaks when running under eventlet on Linux:

File "/usr/local/lib/python3.8/site-packages/kubernetes/stream/ws_client.py", line 182, in update
poll = select.poll()
AttributeError: module 'select' has no attribute 'poll'
module 'select' has no attribute 'poll'

eventlet monkey_patches the select module and does not support the poll() method

Adding a check on getattr(select, "poll", None) is None to the if statement and reverting to select.select when there is no poll attribute will fix the problem.

I'll push a PR

What you expected to happen:

No exception should occur

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): 1.19, 1.21
  • OS (e.g., MacOS 10.13.6): CentOS 7
  • Python version (python --version) 3.8
  • Python client version (pip list | grep kubernetes) 23.3.0
@bobh66 bobh66 added the kind/bug Categorizes issue or PR as related to a bug. label Mar 17, 2022
@bobh66
Copy link
Contributor Author

bobh66 commented Mar 17, 2022

/assign

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 15, 2022
Akasurde added a commit to Akasurde/kubernetes-client-python that referenced this issue Jun 30, 2022
When eventlet is monkey patched, select.poll is removed since
it is not thread safe. So check availability of `poll` method
before using it.

Fixes: kubernetes-client#1753
Fixes: kubernetes-client#1686

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@Akasurde
Copy link
Contributor

Akasurde commented Jul 4, 2022

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
4 participants