curl-client icon indicating copy to clipboard operation
curl-client copied to clipboard

Issue 55 curl multirunner burn cpu

Open mekras opened this issue 5 years ago • 2 comments

mekras avatar Apr 10 '19 19:04 mekras

Hi i'm running into this, any merge planned ? Any help needed ? We actually kickfixed like this ...

$status = curl_multi_exec($this->multiHandle, $active);
$info = curl_multi_info_read($this->multiHandle);
if (false !== $info) {
                ...
}else{
 // fixing issue https://github.com/php-http/curl-client/issues/55
 usleep(self::MULTI_RUNNER_USLEEP);
}

ricostone avatar Dec 10 '19 14:12 ricostone

from https://github.com/elastic/elasticsearch-php/issues/990:

a solution proposed at https://bugs.php.net/bug.php?id=61141#1348321490 is

while ($active && $mrc == CURLM_OK) {
    if (curl_multi_select($mh) == -1) usleep(100);
    do { $mrc = curl_multi_exec($mh, $active); }
    while ($mrc == CURLM_CALL_MULTI_PERFORM);
}

(which we should format according to our code style, but functionality seems good to me. 100 micro seconds is 1 thousandst of a second, so should be an acceptable delay while lowering the cpu)

dbu avatar Jan 22 '20 10:01 dbu