Skip to content
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

net/http: http2 addConnIfNeeded with the same key multiple. #42762

Closed
xiekeyi98 opened this issue Nov 21, 2020 · 6 comments
Closed

net/http: http2 addConnIfNeeded with the same key multiple. #42762

xiekeyi98 opened this issue Nov 21, 2020 · 6 comments

Comments

@xiekeyi98
Copy link

@xiekeyi98 xiekeyi98 commented Nov 21, 2020

Before, I file the issue: #42662 .
But I closed it because I think it may something wrong with the server.

I'm trying to make why the HTTP client retries again and again and why the fd get high.

I compiled with this commit: xiekeyi98@a8c91a2

and the debug message makes me confused.

 GODEBUG=http2debug=1 ./go run ./main2.go 2>&1 | grep "keyixie"
2020/11/22 03:27:55 keyixie t1 TLS NextProto if.
2020/11/22 03:27:55 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:55 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie addConnIfNeeded [key=firmacct.html5.qq.com:443]
2020/11/22 03:27:56 keyixie [key=firmacct.html5.qq.com:443]

I was wondering if someone may help me to make it clear? Why it retry with the same key(firmacct.html5.qq.com:443) again and again?
Thanks a lot!

@xiekeyi98
Copy link
Author

@xiekeyi98 xiekeyi98 commented Nov 21, 2020

@xiekeyi98 xiekeyi98 changed the title net/http: http2 addConnIfNeeded the same key multiple. net/http: http2 addConnIfNeeded with the same key multiple. Nov 23, 2020
@networkimprov
Copy link

@networkimprov networkimprov commented Nov 24, 2020

@fraenkel
Copy link
Contributor

@fraenkel fraenkel commented Nov 25, 2020

It will be more obvious if you turn on http2 debug. You are making an http2 request which fails. The default behavior is to retry until certain conditions hold true.
In your case, the timeout will stop the retry.

@xiekeyi98
Copy link
Author

@xiekeyi98 xiekeyi98 commented Nov 25, 2020

It will be more obvious if you turn on http2 debug. You are making an http2 request which fails. The default behavior is to retry until certain conditions hold true.
In your case, the timeout will stop the retry.

Thank you for your kindly help. I would like to know if it is necessary to retry with more than one handle, the default client timeout is unlimited, which causes the handles to be easily exhausted.

@fraenkel
Copy link
Contributor

@fraenkel fraenkel commented Nov 25, 2020

Again, look at what is actually happening. You are sending a request but the reply is an immediate RST_STREAM with REFUSED_STREAM.

Per 8.1.4 of the http2 spec:
Requests that have not been processed have not failed; clients MAY
automatically retry them, even those with non-idempotent methods.

@xiekeyi98
Copy link
Author

@xiekeyi98 xiekeyi98 commented Nov 25, 2020

@xiekeyi98 xiekeyi98 closed this Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.