-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Immediate timeout on reused curl handle with low speed limit set #17139
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
Comments
@Coderlane thanks for your detailed report. I believe your analysis is correct and the failed rewind should lead to an early error, not a transfer failed unreliably later. Will work on a fix... |
Calls to `Curl_init_do()` did not check on result and missed failures to properly and completely initialize a transfer request. The main cause of such an init failure is the need to rewind the READFUNCTION without a SEEKFUNCTION registered. Check the failure to "rewind" the upload data immediately make test cases 1576 and friends fail. refs curl#17139
I made the fix in #17150 (and found a bug in a test case that way). Could you test that in your setup? Thanks! |
Thank you! I'll give it a try and get back to you. |
177f7b3 seems correct to me. The request now fails with Here are the logs:
|
Calls to `Curl_init_do()` did not check on result and missed failures to properly and completely initialize a transfer request. The main cause of such an init failure is the need to rewind the READFUNCTION without a SEEKFUNCTION registered. Check the failure to "rewind" the upload data immediately make test cases 1576 and friends fail. Reported-by: Travis Lane Fixes curl#17139 Closes curl#17150
Uh oh!
There was an error while loading. Please reload this page.
I did this
I have a curl easy handle that is used with
curl_easy_perform
to periodically POST data. The easy handle is reused between requests to take advantage of the cached connection. Data is attached to the upload viaCURLOPT_READFUNCTION
. However, aCURLOPT_SEEKFUNCTION
is not configured.To avoid stalled connections,
CURLOPT_LOW_SPEED_LIMIT
is set:Occasionally, I'll see the following behavior:
CURLOPT_LOW_SPEED_LIMIT
before receiving the responseSee annotated_log.txt for annotated logs from
CURLOPT_DEBUGFUNCTION
.Suspicion:
I think the behavior in part 3 above occurs because the
rewind
bit is still set on the request from the previous (failed) request. WhenCurl_init_do
is called at the start of the request in part 3, it callsCurl_req_start
->Curl_req_soft_reset
->Curl_client_start
which will attempt to perform a rewind. This rewind is guaranteed to fail, because I'm using a read function and don't have a seek function.Popping back to
Curl_init_do
, ifCurl_req_start
failsCurl_speedinit
will not be called:curl/lib/url.c
Lines 3853 to 3858 in 657aae7
None of the call sites of
Curl_init_do
check the result of the function:curl/lib/url.c
Lines 3555 to 3558 in 657aae7
curl/lib/url.c
Lines 3706 to 3714 in 657aae7
This is ultimately what triggers the
CURLOPT_LOW_SPEED_LIMIT
failure on an otherwise successful request. The speed data on request 3 is still the speed data from request 2. Thus, it looks like request 3 has stalled.I expected the following
I'd expect
curl_easy_perform
to fail if a required seek fails. IE: The result ofCurl_init_do
should be checked.I'd expect the
rewind
bit to be reset after the request, but I'm not sure this is a reasonable expectation. For my use, each call tocurl_easy_perform
is a request and rewinding before sending any data has no meaning. I'm not sure if this holds for all use cases.curl/libcurl version
libcurl 8.12.1 w/ boringssl
operating system
macOS 15.4.1 (24E263)
The text was updated successfully, but these errors were encountered: