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 aborts after half of the connection timeout #10514

Closed
mkauf opened this issue Feb 14, 2023 · 2 comments
Closed

curl aborts after half of the connection timeout #10514

mkauf opened this issue Feb 14, 2023 · 2 comments
Assignees

Comments

@mkauf
Copy link
Contributor

mkauf commented Feb 14, 2023

The connection timeout handling is broken since commit dbd16c3 (found this commit with git bisect).

I did this

time curl --connect-timeout 10 http://my-server:11223/

my-server is a special system that drops everything on port 11223. iptables rule on this server: iptables -A INPUT -p tcp --destination-port 11223 -j DROP. It has an IPv4 address and an IPv6 address.

Before the mentioned commit (curl <= 7.69.1):

curl: (28) Connection timed out after 10001 milliseconds

real	0m10.004s
user	0m0.002s
sys	0m0.001s

-> that's expected

After the mentioned commit:

curl: (28) Failed to connect to my-server port 11223: Connection timed out

real	0m5.205s
user	0m0.000s
sys	0m0.003s

5.2 seconds = (connection timeout) / 2 + (happy eyeballs timeout)

Current master:

curl: (28) Failed to connect to my-server port 11223 after 5000 ms: Timeout was reached

real	0m5.002s
user	0m0.000s
sys	0m0.003s

I expected the following

curl aborts after the connection timeout (10 seconds) and not after half of the connection timeout (5 seconds)

curl/libcurl version

curl 7.87.1-DEV (x86_64-pc-linux-gnu) libcurl/7.87.1-DEV nghttp2/1.51.0
Release-Date: [unreleased]
Protocols: dict file ftp gopher http imap mqtt pop3 rtsp smtp telnet tftp
Features: alt-svc AsynchDNS HTTP2 IPv6 Largefile threadsafe UnixSockets

operating system

Linux myhost 6.1.10-100.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Feb 6 19:58:39 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

icing added a commit to icing/curl that referenced this issue Feb 15, 2023
- refers to the observation in curl#10514
- connect timeout was used at half the configured value, if the
  destination had 1 ip version 4 and other version 6 addresses
  (or the other way around)
- extended test2600 to reproduce these cases
@icing icing self-assigned this Feb 15, 2023
@icing
Copy link
Contributor

icing commented Feb 15, 2023

@mkauf: would you be able to run #10517 in your setup? I found cases where the effective connect timeout was halfed.

@mkauf
Copy link
Contributor Author

mkauf commented Feb 15, 2023

@icing : Yes, I have tested it. Your pull request fixes this bug 👍

@bagder bagder closed this as completed in cc52bc4 Feb 16, 2023
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
- connect timeout was used at half the configured value, if the
  destination had 1 ip version 4 and other version 6 addresses
  (or the other way around)
- extended test2600 to reproduce these cases

Reported-by: Michael Kaufmann
Fixes curl#10514
Closes curl#10517
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants