Skip to content

Default to HTTP/2 on dotnet5 #590

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

Closed
wants to merge 1 commit into from

Conversation

brendandburns
Copy link
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 18, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 18, 2021
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 18, 2021
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 18, 2021
@brendandburns brendandburns requested review from tg123 and removed request for krabhishek8260 March 18, 2021 23:17
@tg123
Copy link
Member

tg123 commented Mar 18, 2021

let me cherrypick and test
seems i missed DefaultRequestVersion = 2 last time

@brendandburns
Copy link
Contributor Author

yeah, there's no version negotiation in HTTP :)

var sh = new SocketsHttpHandler
{
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests,
KeepAlivePingDelay = new TimeSpan(0, 3, 0), // Send pings every three minutes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
KeepAlivePingDelay = new TimeSpan(0, 3, 0), // Send pings every three minutes
KeepAlivePingDelay = TimeSpan.FromMinutes(3), // Send pings every three minutes

{
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests,
KeepAlivePingDelay = new TimeSpan(0, 3, 0), // Send pings every three minutes
KeepAlivePingTimeout = new TimeSpan(0, 0, 30), // Timeout pings after 30s of no response
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
KeepAlivePingTimeout = new TimeSpan(0, 0, 30), // Timeout pings after 30s of no response
KeepAlivePingTimeout = TimeSpan.FromSeconds(30), // Timeout pings after 30s of no response

@@ -243,6 +246,10 @@ private void CreateHttpClient(DelegatingHandler[] handlers, KubernetesClientConf

AppendDelegatingHandler<WatcherDelegatingHandler>();
HttpClient = new HttpClient(FirstMessageHandler, false);

#if NET5_0
HttpClient.DefaultRequestVersion = HttpVersion.Version20;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does NOT work,
see https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.defaultrequestversion?view=net-5.0

The DefaultRequestVersion property doesn't apply to the SendAsync method. The HttpRequestMessage parameter passed as the argument to the SendAsync method has its own Version property that controls the HTTP version used for the request.

Unfortunately, our generated code use SendAsync LOL

Here is my test (Should find a way to do automation)

  1. create a AKS (1.19)
  2. disable tcp keepalive
  3. start watch example

got a [R] from remote side after 5 min and then watch will not show any event from kubectl run

02:42:58.973029 IP 10.x.x.x.49746 > 52.x.x.x.443: Flags [.], ack 28897, win 492, options [nop,nop,TS val 255369207 ecr 3243887534], length 0
02:47:48.004159 IP 52.x.x.x.443 > 10.x.x.x.49746: Flags [R], seq 660228079, win 0, length 0

@tg123
Copy link
Member

tg123 commented Mar 21, 2021

please pick #592 into this PR
and I tested requests to http will down to http1.1 automatically

@alvaroaleman
Copy link

@brendandburns: PR needs rebase.

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.

1 similar comment
@k8s-ci-robot
Copy link
Contributor

@brendandburns: PR needs rebase.

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants