Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Use select.poll() for exec on linux/darwin #268

Merged
merged 1 commit into from
Dec 14, 2021

Conversation

jsun-splunk
Copy link
Contributor

@jsun-splunk jsun-splunk commented Nov 29, 2021

What type of PR is this?

/kind bug

What this PR does / why we need it:

For an exec call, the current WSClient implementation uses select.select() to wait for file descriptor that are ready for read. The select.select() method uses the select() system call for this. As the select() system call has a limitation where by it will return the following error if the file descriptor # is greater than 1024.

Reason: filedescriptor out of range in select()

This limitation happens at scale when are running a large number of exec calls from a single client process. Once the filedescriptor number goes pass 1024 all future exec calls will experience the above error.

By switching to select.poll() instead, we can over come this limitation. The caveat here is that select.poll() is only supported on unix based OS, where as select.select() is also support on Windows. However, even if this is the case, it would be better to use the select.poll() where possible so we can overcome this limitation even if it is on unix based OS.

Which issue(s) this PR fixes:

Similar problem was previously discussed in these issues.
#53
#106

Special notes for your reviewer:

Another option here is to use select.epoll() instead of select.poll() for linux, however, I did not fully understand the difference between the two and did not felt confident enough to try epoll.

Does this PR introduce a user-facing change?

NONE

Use select.poll() for exec on linux/darwin to improve scalability of WSClient

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 29, 2021
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 29, 2021

CLA Signed

The committers are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please log a ticket with the Linux Foundation Helpdesk: https://support.linuxfoundation.org/
  • Should you encounter any issues with the Linux Foundation Helpdesk, send a message to the backup e-mail support address at: [email protected]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 29, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @jsun-splunk!

It looks like this is your first PR to kubernetes-client/python-base 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/python-base has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 29, 2021
@yliaog
Copy link
Contributor

yliaog commented Nov 29, 2021

/check-cla

@jsun-splunk jsun-splunk changed the title Use select.poll() for exec on linux/darwin [WIP] Use select.poll() for exec on linux/darwin Nov 29, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 29, 2021
@jsun-splunk jsun-splunk force-pushed the scaling-k8s branch 2 times, most recently from ef58a56 to fd23cb3 Compare November 29, 2021 23:10
@roycaihw
Copy link
Member

roycaihw commented Dec 6, 2021

/assign

Thanks for sending the fix! Please let us know when it's ready for review.

@jsun-splunk
Copy link
Contributor Author

Hi @roycaihw - thanks for looking into this. I'm just waiting on some internal process to sign off the CLA. The PR is actually ready to be reviewed.

@jsun-splunk
Copy link
Contributor Author

I signed it

@jsun-splunk
Copy link
Contributor Author

/check-cla

@jsun-splunk jsun-splunk changed the title [WIP] Use select.poll() for exec on linux/darwin Use select.poll() for exec on linux/darwin Dec 13, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 13, 2021
@jsun-splunk
Copy link
Contributor Author

/check-cla

@jsun-splunk
Copy link
Contributor Author

i signed it

@jsun-splunk
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot
Copy link
Contributor

@jsun-splunk: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@roycaihw
Copy link
Member

/lgtm
/approve
/check-cla

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 13, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsun-splunk, roycaihw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Dec 13, 2021
@roycaihw
Copy link
Member

The CLA check still doesn't pass. Please make sure you've signed the CLA, and the email matches the one used in the Git commits.

@jsun-splunk
Copy link
Contributor Author

/check-cla

1 similar comment
@jsun-splunk
Copy link
Contributor Author

/check-cla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 14, 2021
@k8s-ci-robot k8s-ci-robot merged commit 06191d3 into kubernetes-client:master Dec 14, 2021
@jsun-splunk
Copy link
Contributor Author

hi @roycaihw,

Now this is merged, do you know how we can update the submodule in the top leve client (https://github.com/kubernetes-client/python/tree/master/kubernetes)? I can't seem to find any instructions on how to release the submodules.

Thanks!

@roycaihw
Copy link
Member

Please follow this instruction to update the submodule and create a PR. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants