-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[release-0.58]: Bugfix: virt-handler socket leak #9002
[release-0.58]: Bugfix: virt-handler socket leak #9002
Conversation
Skipping CI for Draft Pull Request. |
e9a5b33
to
0bcce59
Compare
/cc @enp0s3 @Barakmor1 Would appreciate your review :) |
0bcce59
to
2cc5eab
Compare
2cc5eab
to
12d9a09
Compare
/hold Blocked by #9004. |
In other words: that the number of connections does not grow when making multiple client calls Signed-off-by: Itamar Holder <[email protected]>
matcher.HaveConditionTrue() is not supported in release-0.53, therefore this commit fallbacks to the old method of checking the condition. Signed-off-by: Itamar Holder <[email protected]>
By default, virt-handler's HTTP server keeps connections opened in order to reuse them whenever possible. But, by default, the HTTP server doesn't define any timeout for the keep-alive mechanism, hence keeping the connection opened forever. This commit sets a timeout of 60 seconds to the keep-alive mechanism. Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Now that an HTTP client is added to NewVirtHandlerClient() as a new parameter, many tests have to use an empty client. This function fetches the virt-handler pod with an empty HTTP client. Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
This is necesarry for connection re-use. As client.Do()'s documentation says: "If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close. If the Body is not both read to EOF and closed, the Client's underlying RoundTripper (typically Transport) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request." Source: https://pkg.go.dev/net/http#Client.Do Signed-off-by: Itamar Holder <[email protected]>
Same logic is used twice, now it's extracted into a helper function. This is especially important since this helper function makes sure that the response is properly close which can prevent future bugs. Signed-off-by: Itamar Holder <[email protected]>
12d9a09
to
5db003d
Compare
/lgtm Thank you! |
/lgtm |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enp0s3 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 |
/retest |
@iholder101: The following test failed, say
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. |
/hold cancel |
What this PR does / why we need it:
Manual backport for #8948.
Special notes for your reviewer:
The only interesting reason for a backport is the following commit: 49dd3c5. In the original PR I was using a matcher (
matcher.HaveConditionTrue()
) that doesn't exist in this branch. Therefore, I'm manually checking the condition instead.Release note: