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
High CPU usage with -T . #13174
Comments
The |
@rsbeckerca thanks for the report. I can reproduce locally that indeed curl cycles through read/recv attempts indefinitely without pausing. |
After analysis, we would need an addition to the libcurl API, basically a new option, that allows to unpause transfer sending when a socket becomes readable. Sine this is not a "few lines" fix, it might take a while. |
To avoid getting stuck in a busy-loop when nothing is read from stdin, this function now checks the call rate and might enforce a short sleep when called repeatedly without uploading anything. It is a crude work-around to avoid a 100% busy CPU. Reported-by: magisterquis on hackerone Fixes #13174
I propose a work-around in #13506 that should ideally at least reduce the busy-looping. |
I did this
./long_running_command | curl -T. https://my_server
The idea is to have output from the command sent to my server as it's produced.
Reproduces with
I expected the following
Output to show up server-side, which it did.
Client-side, the curl's CPU usage to be nearly 0 most of the time, which it wasn't. After a while, it hits nearly 100%.
It seems to be hitting a tight loop which calls
poll
,read
, andrecvfrom
:File descriptor 5 is the network socket:
It's more or less the same on Linux, according to
strace
.curl/libcurl version
As well as
operating system
The text was updated successfully, but these errors were encountered: