Skip to content

Retry with exponential backoff not working in curl 8.16.0 #18591

@olsen232

Description

@olsen232

I did this

I ran curl 8.16.0 with --retry 4. No exponential backoff is observed

$ docker run curlimages/curl:8.16.0 localhost:1234 --retry 4 --retry-connrefused
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 1 second. 4 retries left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 1 second. 3 retries left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 1 second. 2 retries left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 1 second. 1 retry left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server

Maybe broken by 4d025fd ?

I expected the following

Previously on curl 8.15.0, exponential backoff is the default.
This change in behaviour is not documented, presumably is unintentional?

docker run curlimages/curl:8.15.0 localhost:1234 --retry 4 --retry-connrefused
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 1 second. 4 retries left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 2 seconds. 3 retries left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 1 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 4 seconds. 2 retries left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server
Warning: Problem : connection refused. Will retry in 8 seconds. 1 retry left.
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to localhost port 1234 after 0 ms: Could not connect to server

curl/libcurl version

curl 8.16.0 (aarch64-unknown-linux-musl) libcurl/8.16.0 OpenSSL/3.5.2 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.65.0
Release-Date: 2025-09-10
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

operating system

Linux 0219521c82a8 6.10.14-linuxkit #1 SMP Fri Nov 29 17:22:03 UTC 2024 aarch64 Linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions