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

curl + quiche: need to close the connection #6213

Closed
junhochoi opened this issue Nov 17, 2020 · 2 comments
Closed

curl + quiche: need to close the connection #6213

junhochoi opened this issue Nov 17, 2020 · 2 comments
Assignees

Comments

@junhochoi
Copy link
Contributor

@junhochoi junhochoi commented Nov 17, 2020

I did this

When I use curl (build with quiche) for http3 request, sometimes it stucks at n-th run, but it's random (60 - 300 range).

for i in $(seq 1 1000)
do
   curl --http3 https://http3-server/1k.png
done

I expected the following

It should continuously run curl commands without failure.

When I look at server log, I have found the following:

  • curl doesn't seems to properly close QUIC connection, by calling quiche_conn_close()
  • this cause the server to close the connection by idle timeout
  • before idle timeout expires, if next curl command try to reuse the same udp port which is not closed in the server, the server think it's a part of existing connection and drop the packet because it expects a short QUIC packet but long (Initial) packet is received. That's why it looks random (=up to the client OS picking up the source udp port)

curl/libcurl version

$ curl -V
curl 7.74.0-DEV (x86_64-apple-darwin19.6.0) libcurl/7.74.0-DEV SecureTransport (BoringSSL) zlib/1.2.11 brotli/1.0.7 zstd/1.4.5 libidn2/2.3.0 nghttp2/1.41.0 quiche/0.6.0 librtmp/2.3
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HTTP2 HTTP3 IDN IPv6 Largefile libz MultiSSL NTLM NTLM_WB SSL UnixSockets zstd

operating system

$ uname -a
Darwin <hostname> 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
@tatsuhiro-t
Copy link
Contributor

@tatsuhiro-t tatsuhiro-t commented Nov 17, 2020

I think that if Initial packet has a different CID, then it should be treated as new connection. If server only considers client address and port to associate QUIC connection, it is impossible for client to share a single port between multiple connections.
That said, I think it would be polite to explicitly close the connection if curl knows it does not use the connection anymore.

@bagder bagder self-assigned this Nov 17, 2020
bagder added a commit that referenced this issue Nov 18, 2020
Reported-by: Junho Choi
Fixes #6213
@bagder
Copy link
Member

@bagder bagder commented Nov 18, 2020

@junhochoi does #6217 make things better for your case?

bagder added a commit that referenced this issue Dec 1, 2020
Reported-by: Junho Choi
Fixes #6213
Closes #6217
@bagder bagder closed this in 26f682b Dec 2, 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.

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