Bug #61240 [Com]: curl_multi_select cause cpu load 100%
Edit report at https://bugs.php.net/bug.php?id=61240&edit=1 ID: 61240 Comment by: niniwzw at qq dot com Reported by:niniwzw at qq dot com Summary:curl_multi_select cause cpu load 100% Status: Open Type: Bug Package:cURL related Operating System: window xp PHP Version:5.3.10 Block user comment: N Private report: N New Comment: the best solution work without the curl_multi_select may be this: http://lxr.php.net/";); curl_setopt($ch1, CURLOPT_HEADER, 0); curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/";); curl_setopt($ch2, CURLOPT_HEADER, 0); //create the multiple cURL handle $mh = curl_multi_init(); //add the two handles curl_multi_add_handle($mh,$ch1); curl_multi_add_handle($mh,$ch2); $active = null; $exec_count = 0; do { $mrc = curl_multi_exec($mh, $active); usleep(1); $exec_count++; } while ($mrc == CURLM_CALL_MULTI_PERFORM || ($active && $mrc == CURLM_OK)); //close the handles curl_multi_remove_handle($mh, $ch1); curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); var_dump($exec_count); ?> I scan the source code of curl_multi_select, there was no change from php 5.2.17 to 5.3.10, may be it's the problem of libcurl(curl_multi_fdset, fuction) Previous Comments: [2012-04-03 16:27:47] bompus at gmail dot com Related to 60790 and 61141 -------- [2012-03-02 08:51:47] niniwzw at qq dot com Description: --- >From manual page: http://www.php.net/function.curl-multi-exec --- In the document of curl_multi_exec, has a example in the document. it can run in php 5.2, but php 5.3 and php 5.4 cause cpu load 100%. the example is: http://lxr.php.net/";); curl_setopt($ch1, CURLOPT_HEADER, 0); curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/";); curl_setopt($ch2, CURLOPT_HEADER, 0); //create the multiple cURL handle $mh = curl_multi_init(); //add the two handles curl_multi_add_handle($mh,$ch1); curl_multi_add_handle($mh,$ch2); $active = null; //execute the handles do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active && $mrc == CURLM_OK) { if (curl_multi_select($mh) != -1) { do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } //close the handles curl_multi_remove_handle($mh, $ch1); curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); ?> -- Edit this bug report at https://bugs.php.net/bug.php?id=61240&edit=1
[PHP-BUG] Bug #61240 [NEW]: curl_multi_select cause cpu load 100%
From: Operating system: window xp PHP version: 5.3.10 Package: cURL related Bug Type: Bug Bug description:curl_multi_select cause cpu load 100% Description: --- >From manual page: http://www.php.net/function.curl-multi-exec --- In the document of curl_multi_exec, has a example in the document. it can run in php 5.2, but php 5.3 and php 5.4 cause cpu load 100%. the example is: http://lxr.php.net/";); curl_setopt($ch1, CURLOPT_HEADER, 0); curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/";); curl_setopt($ch2, CURLOPT_HEADER, 0); //create the multiple cURL handle $mh = curl_multi_init(); //add the two handles curl_multi_add_handle($mh,$ch1); curl_multi_add_handle($mh,$ch2); $active = null; //execute the handles do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active && $mrc == CURLM_OK) { if (curl_multi_select($mh) != -1) { do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } //close the handles curl_multi_remove_handle($mh, $ch1); curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); ?> -- Edit bug report at https://bugs.php.net/bug.php?id=61240&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61240&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61240&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61240&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61240&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61240&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61240&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61240&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61240&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61240&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61240&r=support Expected behavior: https://bugs.php.net/fix.php?id=61240&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61240&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61240&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61240&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61240&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=61240&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61240&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61240&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61240&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61240&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61240&r=mysqlcfg