You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zrlw (via GitHub)" <gi...@apache.org> on 2025/06/09 05:21:42 UTC
[PR] [3.3] Add http2 client connection preface process [dubbo]
zrlw opened a new pull request, #15436:
URL: https://github.com/apache/dubbo/pull/15436
## What is the purpose of the change?
submit pr again for https://github.com/apache/dubbo/pull/15368 which has been reverted because it has defects should be fixed.
try to fix #15233 ```No provider available``` issue, the roots of the issue is client sent large headers frame before receiving server connection preface (http2 settings frame), which cause server sent back go away frame and the connection was disconnected by the server.

see details at https://httpwg.org/specs/rfc7540.html#ConnectionHeader
```
3.5. HTTP/2 Connection Preface
In HTTP/2, each endpoint is required to send a connection preface as a final confirmation of the protocol in use and to establish the initial settings for the HTTP/2 connection. The client and server each send a different connection preface.
The client connection preface starts with a sequence of 24 octets, which in hex notation is:
0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a
That is, the connection preface starts with the string PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n). This sequence MUST be followed by a SETTINGS frame (Section 6.5), which MAY be empty.
... ...
The server connection preface consists of a potentially empty SETTINGS frame (Section 6.5) that MUST be the first frame the server sends in the HTTP/2 connection.
```
https://quafoo.gitbooks.io/http2-rfc7540-zh-cn-en/content/chapter3/section3.5.html
```
HTTP/2 Connection Preface / HTTP/2连接前奏
在HTTP/2中,要求两端都要发送一个连接前奏,作为对所使用协议的最终确认,并确定HTTP/2连接的初始设置。客户端和服务端各自发送不同的连接前奏。
客户端连接前奏以一个24字节的序列开始,用十六进制表示为:
0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a
即,连接前奏以字符串"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"开始。这个序列后面必须跟一个可以为空的 SETTINGS 帧( 6.5节 )。
... ...
服务端连接前奏包含一个可能为空的 SETTINGS 帧( 6.5节 ),它必须由服务端在HTTP/2连接中首先发送。
```
## Checklist
- [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
- [x] Make sure gitHub actions can pass. [Why the workflow is failing and how to fix it?](../CONTRIBUTING.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] [3.3] Add http2 client connection preface process [dubbo]
Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw merged PR #15436:
URL: https://github.com/apache/dubbo/pull/15436
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] [3.3] Add http2 client connection preface process [dubbo]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #15436:
URL: https://github.com/apache/dubbo/pull/15436#issuecomment-2954706803
## [Codecov](https://app.codecov.io/gh/apache/dubbo/pull/15436?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `45.00000%` with `22 lines` in your changes missing coverage. Please review.
> Project coverage is 31.48%. Comparing base [(`6f110c1`)](https://app.codecov.io/gh/apache/dubbo/commit/6f110c10e0e355dd57d383c62266372da19c9010?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`4c687dd`)](https://app.codecov.io/gh/apache/dubbo/commit/4c687dde5b809dd23db86f35def66f1a03bb7c6c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 2 commits behind head on 3.3.
| [Files with missing lines](https://app.codecov.io/gh/apache/dubbo/pull/15436?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...moting/transport/netty4/NettyConnectionClient.java](https://app.codecov.io/gh/apache/dubbo/pull/15436?src=pr&el=tree&filepath=dubbo-remoting%2Fdubbo-remoting-netty4%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdubbo%2Fremoting%2Ftransport%2Fnetty4%2FNettyConnectionClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5Q29ubmVjdGlvbkNsaWVudC5qYXZh) | 31.03% | [16 Missing and 4 partials :warning: ](https://app.codecov.io/gh/apache/dubbo/pull/15436?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...sport/netty4/http2/Http2ClientSettingsHandler.java](https://app.codecov.io/gh/apache/dubbo/pull/15436?src=pr&el=tree&filepath=dubbo-remoting%2Fdubbo-remoting-netty4%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdubbo%2Fremoting%2Ftransport%2Fnetty4%2Fhttp2%2FHttp2ClientSettingsHandler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L2h0dHAyL0h0dHAyQ2xpZW50U2V0dGluZ3NIYW5kbGVyLmphdmE=) | 81.81% | [1 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/dubbo/pull/15436?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (6f110c1) and HEAD (4c687dd). Click for more details.
>
> <details><summary>HEAD has 3 uploads less than BASE</summary>
>
>| Flag | BASE (6f110c1) | HEAD (4c687dd) |
>|------|------|------|
>|integration-tests-java17|1|0|
>|integration-tests-java8|1|0|
>|unit-tests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 3.3 #15436 +/- ##
=============================================
- Coverage 60.90% 31.48% -29.43%
+ Complexity 11423 9626 -1797
=============================================
Files 1887 1888 +1
Lines 86266 86306 +40
Branches 12929 12934 +5
=============================================
- Hits 52540 27171 -25369
- Misses 28290 55037 +26747
+ Partials 5436 4098 -1338
```
| [Flag](https://app.codecov.io/gh/apache/dubbo/pull/15436/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [integration-tests-java17](https://app.codecov.io/gh/apache/dubbo/pull/15436/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/15436/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [samples-tests-java17](https://app.codecov.io/gh/apache/dubbo/pull/15436/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `31.43% <45.00%> (+0.01%)` | :arrow_up: |
| [samples-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/15436/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `29.26% <37.50%> (-0.11%)` | :arrow_down: |
| [unit-tests](https://app.codecov.io/gh/apache/dubbo/pull/15436/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo/pull/15436?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] [3.3] Add http2 client connection preface process [dubbo]
Posted by "oxsean (via GitHub)" <gi...@apache.org>.
oxsean commented on PR #15436:
URL: https://github.com/apache/dubbo/pull/15436#issuecomment-2954855719
LGTM.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] [3.3] Add http2 client connection preface process [dubbo]
Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on PR #15436:
URL: https://github.com/apache/dubbo/pull/15436#issuecomment-2954674439
@oxsean @AlbumenJ PTAL
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] [3.3] Add http2 client connection preface process [dubbo]
Posted by "oxsean (via GitHub)" <gi...@apache.org>.
oxsean commented on code in PR #15436:
URL: https://github.com/apache/dubbo/pull/15436#discussion_r2135148179
##########
dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java:
##########
@@ -97,6 +121,48 @@ protected void initChannel(SocketChannel ch) {
@Override
protected ChannelFuture performConnect() {
+ if (connectionPrefaceReceivedPromiseRef != null) {
+ connectionPrefaceReceivedPromiseRef.compareAndSet(null, new DefaultPromise<>(GlobalEventExecutor.INSTANCE));
+ }
return bootstrap.connect();
}
+
+ @Override
+ protected void doConnect() throws RemotingException {
+ long start = System.currentTimeMillis();
+ super.doConnect();
+ if (connectionPrefaceReceivedPromiseRef == null) {
Review Comment:
Please extract this logic into a separate method, and in the comment, reference [RFC7540#section-3.5](https://datatracker.ietf.org/doc/html/rfc7540#section-3.5) to explain why we need this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org