-
Notifications
You must be signed in to change notification settings - Fork 94
fix: goroutine leak when timeout #1947
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
Conversation
Btw, for |
func WaitUntilTimeout(timeout time.Duration, execFunc ExecFunc, timeoutFunc TimeoutFunc) error { | ||
// Create a channel to receive the result of the azcopy exec function | ||
done := make(chan bool) | ||
done := make(chan bool, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why set buffer size as 1 would fix the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The write operation to a channel in Go is blocking unless there is a receiver waiting for it, this means after WaitUntilTimeout
exit, the goroutine will remain stuck at done <- true
forever.
After changed to buffered channel, even if there is no receiver, done <- true can successfully write and continue.
we could use k8s lib if there is a suitable function, any recommendation? |
we should use |
this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx, cvvz 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 |
/cherrypick release-1.32 |
/cherrypick release-1.31 |
/cherrypick release-1.30 |
/cherrypick release-1.26 |
/cherrypick release-1.25 |
/cherrypick release-1.24 |
@andyzhangx: cannot checkout In response to this:
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. |
@andyzhangx: cannot checkout In response to this:
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. |
@andyzhangx: cannot checkout In response to this:
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. |
@andyzhangx: #1947 failed to apply on top of branch "release-1.26":
In response to this:
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. |
@andyzhangx: #1947 failed to apply on top of branch "release-1.25":
In response to this:
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. |
@andyzhangx: #1947 failed to apply on top of branch "release-1.24":
In response to this:
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. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
fix: goroutine leak when timeout
Which issue(s) this PR fixes:
Fixes #
Requirements:
Special notes for your reviewer:
Release note: