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
Using the CURLOPT_MAX_RECV_SPEED_LARGE option with either libevent or libuv cause downloads to be interrupted #793
Comments
make sure you are passing a curl_off_t type |
Adding the following line to the multi-uv.c example makes it download of small chunk of the target resource then it gracefully exits without error or anything: |
We don't special-case that option for the multi socket API so it works the same as otherwise. And it should just remove the socket as one to monitor for actions and then put it back again when it is below the threshold again. What does libcurl tell your socket callback for the socket you have rate limited like this? |
My socket handler gets called with a CURL_POLL_REMOVE action then it never gets called again unless I call curl_multi_socket_action(handle_, CURL_SOCKET_TIMEOUT, 0, &running_handles); when it happens. Is that normal? |
Surely there's also a timeout (call to the timer function) done before or after that so you will libcurl again at least then, right? |
Ok, I managed to fix my problem, here is what I did to make it work:
Does that even make sense? Thanks for you patience and your help :) |
Thanks @r-cyr! I am using libuv and encounter the exact problem you described. After applying the step 1 of your solution, the problem seems to be gone. So is the step 2 still necessary? |
If step 1 alone makes it work then no need for the step 2. I found that these settings worked well for me by testing the bandwidth throttling at different speed, initially using a high-speed local server and then with dummy files from speed tests. |
After testing more cases, I found the solution doesn't always work well. For example, if I limit the speed to 400KB/s, the test case passes. But it fails if I raise the limitation to 700KB/s. |
I think there is something wrong in either the multi-uv.c example or libcurl itself, but I don't have the ability to figure it out. @jay @bagder could you please take a look? Steps to reproduce:
Now, remove the line |
If you have an issue with a current release of libcurl, then I suggest you post to the curl-library mailing list or create a new issue. Just adding comments to a since-long closed issue will vanish in the general flood of noise. |
Reference #942 |
I'm working on a project involving libuv + libcurl to do HTTP downloads and it works really well until I try to enable download throttling using the CURLOPT_MAX_RECV_SPEED_LARGE option. When I do that, depending on the speed I set, the download will either never start or stall in the middle.
I thought something was wrong with my code until I downloaded the hiperfifo.c (which uses libevent) and the multi-uv.c (libuv) examples and was able to reproduce the same problem by adding the CURLOPT_MAX_RECV_SPEED_LARGE option.
I was able to reproduce the issue with libcurl 7.48 on Linux and OSX.
The text was updated successfully, but these errors were encountered: