kwok icon indicating copy to clipboard operation
kwok copied to clipboard

make GetUnusedPort concurrency safe

Open muff1nman opened this issue 1 year ago • 11 comments

What type of PR is this?

/kind bug

What this PR does / why we need it:

Kwok can be used nicely in go test with parallelism. However when running with -race, GetUnusedPort is flagged as a data race. Ancedotally, during our tests we have seen port contention and this might help resolve that.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

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


muff1nman avatar Sep 05 '24 17:09 muff1nman

Hi @muff1nman. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

k8s-ci-robot avatar Sep 05 '24 17:09 k8s-ci-robot

Deploy Preview for k8s-kwok canceled.

Name Link
Latest commit 763aec1bcc005a147d578974d1e73d4e846fcdcd
Latest deploy log https://app.netlify.com/sites/k8s-kwok/deploys/66d9eec777ef4600085fdf7b

netlify[bot] avatar Sep 05 '24 17:09 netlify[bot]

/ok-to-test

wzshiming avatar Sep 06 '24 02:09 wzshiming

this function should never be used concurrently.

wzshiming avatar Sep 06 '24 02:09 wzshiming

@wzshiming are you saying that I shouldn't be using kwok with https://pkg.go.dev/testing#T.Parallel? I'd find that surprising considering how easy it is to use kwok in testing and with parallelism it makes the tests run very quickly.

muff1nman avatar Sep 06 '24 13:09 muff1nman

Actually I think there is more than just GetUnusedPorts that potentially is a problem.

muff1nman avatar Sep 06 '24 18:09 muff1nman

Actually I think there is more than just GetUnusedPorts that potentially is a problem.

Yes, I know the kwokctl potentially has this problem, but there's no need for parallelism, right?

wzshiming avatar Sep 09 '24 03:09 wzshiming

The difference with t.Parallel is 3.5 minutes vs 23 minutes test runtime. So I'd say its very nice to have.

muff1nman avatar Sep 09 '24 23:09 muff1nman

Hello

I would like to verify what you said, and I have not found any way to do it in this codebase, how do you do it exactly, I would like to verify it.

wzshiming avatar Sep 14 '24 03:09 wzshiming

I would like to verify what you said

Verify which part exactly?

muff1nman avatar Sep 27 '24 16:09 muff1nman

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

This bot triages 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 PR is closed

You can:

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

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

/lifecycle stale

k8s-triage-robot avatar Dec 26 '24 17:12 k8s-triage-robot

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

This bot triages 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 PR is closed

You can:

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

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

/lifecycle rotten

k8s-triage-robot avatar Jan 25 '25 17:01 k8s-triage-robot

/remove-lifecycle rotten

muff1nman avatar Jan 28 '25 02:01 muff1nman

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

This bot triages 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 PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

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

/close

k8s-triage-robot avatar Feb 27 '25 02:02 k8s-triage-robot

@k8s-triage-robot: Closed this PR.

In response to this:

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

This bot triages 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 PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

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

/close

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-sigs/prow repository.

k8s-ci-robot avatar Feb 27 '25 02:02 k8s-ci-robot

/reopen

muff1nman avatar Sep 02 '25 17:09 muff1nman

@muff1nman: Failed to re-open PR: state cannot be changed. The concurrent-unused-port branch was force-pushed or recreated.

In response to this:

/reopen

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-sigs/prow repository.

k8s-ci-robot avatar Sep 02 '25 17:09 k8s-ci-robot

/reopen

muff1nman avatar Sep 02 '25 17:09 muff1nman

@muff1nman: Reopened this PR.

In response to this:

/reopen

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-sigs/prow repository.

k8s-ci-robot avatar Sep 02 '25 17:09 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: muff1nman Once this PR has been reviewed and has the lgtm label, please assign huang-wei for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Sep 02 '25 17:09 k8s-ci-robot

Deploy Preview for k8s-kwok canceled.

Name Link
Latest commit 0aaa171ff8c6f66cc1f1d14c2dea975dc26612ef
Latest deploy log https://app.netlify.com/projects/k8s-kwok/deploys/68b72ff0d61b6a00080cda46

netlify[bot] avatar Sep 02 '25 17:09 netlify[bot]

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

This bot triages 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 PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

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

/close

k8s-triage-robot avatar Oct 02 '25 18:10 k8s-triage-robot

@k8s-triage-robot: Closed this PR.

In response to this:

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

This bot triages 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 PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

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

/close

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-sigs/prow repository.

k8s-ci-robot avatar Oct 02 '25 18:10 k8s-ci-robot