-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Possible busy-looping in curl_multi_poll #4594
Comments
I think it should wait for the timeout period in this case. Something like this? diff --git a/lib/multi.c b/lib/multi.c
index 7e8e38dc9..db08ac636 100755
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1155,10 +1155,12 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
/* Avoid busy-looping when there's nothing particular to wait for */
if(!curl_multi_timeout(multi, &sleep_ms) && sleep_ms) {
if(sleep_ms > timeout_ms)
sleep_ms = timeout_ms;
+ else if((sleep_ms < 0) && extrawait)
+ sleep_ms = timeout_ms;
Curl_wait_ms((int)sleep_ms);
}
}
return CURLM_OK; |
bagder
added a commit
that referenced
this issue
Nov 14, 2019
Fixes #4594 Reported-by: 3dyd on github
Not sure if notification is fired if one comments diff directly, so I am duplicating it here:
|
Confirmed the change has fixed described issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Take a look at this piece of code at the end of
Curl_multi_wait
:curl/lib/multi.c
Lines 1150 to 1161 in 7a46aeb
If
curl_multi_poll
is given valid empty multi handle (no easy handles were added to it [yet]) without extracurl_waitfd
structures thensleep_ms
receives value -1 fromcurl_multi_timeout
effectively avoiding waiting for giventimeout_ms
period. So function returns immediately.Is this intended behavior, and such edge case still has to be accounted by the caller to avoid busy-looping?
The text was updated successfully, but these errors were encountered: