-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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_multi: resumed transfer is not completed although all data was received #3994
Comments
Fetch an URL with a short body, e.g. http://google.com/
Modified example in sstruchtrup/curl@e62b9f6 Output for http://google.com:
The transfer is complete, all 219 bytes were consumed, but no |
Using the curl multi interface without an external event loop, e.g. via |
... so that timeouts or other state machine actions get going again after a changing pause state. For example, if the last delivery was paused there's no pending socket activity. Reported-by: sstruchtrup on github Fixes #3994
I could reproduce the problem and the fix in #4001 made it work for me. It'd be great if you could see if it does for you as well? |
I can confirm that it solves it for me as well, both for the sample code as well as for the actual application. |
Lovely, thanks for confirming! |
I did this
I am using libcurl with the multi interface (and libev) to receive data via http. Received data will be written to a relatively slow flash memory.
curl_easy_pause()
is used for flow control.I noticed stuck transfers when the transfer is paused on the last invocation on the write callback, i.e. when the last chunk (in a non-http sense) of data is received. Once the transfer is resumed, it does not complete, although all data was received.
I observed the problem both when using
curl_easy_pause(easy, CURLPAUSE_ALL)
(consuming the data) from within the callback and as well when returningCURL_WRITEFUNC_PAUSE
from the callback (without consuming the data).Restarting the transfer will deliver the remaining data, in case it was not consumed (by returning
CURL_WRITEFUNC_PAUSE
). But in any case the transfer is not completed, that isCURLMSG_DONE
is not received. It looks it will eventually be delivered, likely once the server closes the connection.The application is single-threaded.
I will submit a example to demonstrate the problem, based on the
evhiperfifo.c
example, modified to pause the transfer on the first invocation and restart it after one second.Fetching a resource with a short body (single callback invocation) will demonstrate the problem, e.g. http://google.com.
I expected the following
The transfer shall complete once all data was received.
CURLMSG_DONE
should be delivered bycurl_multi_info_read()
.curl/libcurl version
[curl -V output]
I tested current curl master as well as curl 7.40 and 7.29/7.30, all seem to show this problem.
operating system
Linux / Ubuntu 18.04
The text was updated successfully, but these errors were encountered: