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
HTTP request timeout with CURLMOPT_MAX_TOTAL_CONNECTIONS set low #6744
Comments
Why this happens: When a connection is moved from the PENDING state (waiting for a connection) it is moved to CONNECT state and the
This has the effect that with I haven't yet really figured out exactly how I think this should be fixed... |
He set an option that limits the number of connections. I don't see the bug, what am I missing? |
That's why the queued transfers are in the PENDING state.
|
They take 1000ms to get canceled just not including queue time, and that's the rub, if I understand you correctly. |
Basically, yes. Which isn't how it is supposed to work. I have a local fix I think is decent and very simple. I'll only test it out a little bit more first... |
The duration of a connect and the total transfer are calculated from two different time-stamps. It can end up with the total timeout triggering before the connect timeout expires and we should make sure to acknowledge whichever timeout that is reached first. This is especially notable when a transfer first sits in PENDING, as that time is counted in the total time but the connect timeout is based on the time since the handle changed to the CONNECT state. Fixes #6744 Reported-by: Andrei Bica
The duration of a connect and the total transfer are calculated from two different time-stamps. It can end up with the total timeout triggering before the connect timeout expires and we should make sure to acknowledge whichever timeout that is reached first. This is especially notable when a transfer first sits in PENDING, as that time is counted in the total time but the connect timeout is based on the time since the handle changed to the CONNECT state. The CONNECTTIMEOUT is per connect attempt. The TIMEOUT is for the entire operation. Fixes #6744 Reported-by: Andrei Bica
Should https://github.com/curl/curl/blob/master/tests/unit/unit1303.c have been updated to reflect this change? |
(Issue filed on behalf of Andrei Bica)
I've managed to produce this behavior by using a modified multi-poll.c example (see below) which makes 10 HTTP requests to "example.org:8200", set
CURLOPT_TIMEOUT_MS
to 1000 for each request andCURLMOPT_MAX_TOTAL_CONNECTIONS
to 1 for the multi handle.I've used iptables to drop all packets going to URL address:
I would expect the runtime to be around 1000 ms (the value of
CURLOPT_TIMEOUT_MS
), but instead I get a runtime of about 7000 ms.operating system
Linux
The text was updated successfully, but these errors were encountered: