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

http3: redial for unresolved or staled connections #3943

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lifenjoiner
Copy link

unresolved:
Valid parameters, but handshake is not completed successfully.

staled:
A server may close the connection after requests are responsed, that stops to reuse it.

Complement #3684 (89769f4).

unresolved:
Valid parameters, but handshake is not completed successfully.

staled:
A server may close the connection after requests are responsed, that stops
to reuse it.

Complement quic-go#3684 (89769f4).
@google-cla
Copy link

google-cla bot commented Jul 9, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@lifenjoiner
Copy link
Author

lifenjoiner commented Jul 9, 2023

Unfortunately, I failed to create a google account to sign the CLA.
Signed.

@lifenjoiner
Copy link
Author

CLA signed.

@lifenjoiner
Copy link
Author

The problem is about a serial requests on the same host with one http client (dialOnce with only one http3 client allowed):

  1. if a request failed, the following will all fail then;
  2. if a request succeeded, but the server closed the connection before a following request, then the following requests fail too.

2 Connection %s closed examples for case 2:

2023/07/13 12:28:17 client Starting new connection to dnsnl.alekberg.net (0.0.0.0:56325 -> 89.38.131.38:443), source connection ID (empty), destination connection ID 402a368ce3b7c22bd1, version v1
[2023-07-13 12:28:18] [INFO] [ams-doh-nl] TLS version: 304 - Protocol: h3 - Cipher suite: 4865
[2023-07-13 12:28:18] [NOTICE] [ams-doh-nl] OK (DoH) - rtt: 937ms
...
2023/07/13 12:28:26 client Peer closed connection with error: Application error 0x100 (remote)
2023/07/13 12:28:26 client Connection 402a368ce3b7c22bd1 closed.
2023/07/13 12:29:43 client Starting new connection to dnsse.alekberg.net (0.0.0.0:55470 -> 45.153.187.96:443), source connection ID (empty), destination connection ID a588febf56ac99eb492740141f7a2ceb9a5868, version v1
[2023-07-13 12:29:44]   127.0.0.1       github.com      A       PASS    1274ms  sth-doh-se
2023/07/13 12:29:47 client Destroying connection with error: received a stateless reset with token 562d402ae2234d37a9835b78a48d541c
2023/07/13 12:29:47 client Connection a588febf56ac99eb492740141f7a2ceb9a5868 closed.

@marten-seemann
Copy link
Member

What's the issue this PR is supposed to resolve?

@lifenjoiner
Copy link
Author

In the scenario where a http3 client acts as a proxy.
When "Connection %s closed" happened, the RoundTripper should be able to initialize a new client. Or, the following requests will be refused/reset by that host.

Some servers close the connection very quickly, refer to my above examples (in seconds).
Some longer:

2023/07/14 12:04:24 client Starting new connection to cloudflare-dns.com ([::]:51217 -> 104.16.248.249:443), source connection ID (empty), destination connection ID ac0f77e9e1671161aeaeb34e9c, version v1
2023/07/14 12:04:24 client Queueing packet (1053 bytes) for later decryption
2023/07/14 12:09:52 client Peer closed connection with error: Application error 0x100 (remote)
2023/07/14 12:09:52 client Connection ac0f77e9e1671161aeaeb34e9c closed.

Must an issue be logged for each PR?

@marten-seemann
Copy link
Member

In the scenario where a http3 client acts as a proxy.
When "Connection %s closed" happened, the RoundTripper should be able to initialize a new client. Or, the following requests will be refused/reset by that host.

I don’t think this is accurate. You can send multiple request over the same connection, there’s no need to close it in between.

@lifenjoiner
Copy link
Author

there’s no need to close it in between.

Yes. But, the issue is the remote server closed the connection, as a user I can't use the client anymore.

@lifenjoiner
Copy link
Author

Without redo handshake, extra data sent are refused.

@lifenjoiner
Copy link
Author

Similarly, dnsproxy wrapped their own http3Transport to catch the closed status to recreate the http client.
We could make life easier here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants