Bug #61240 [Com]: curl_multi_select cause cpu load 100%
| From: | bompus at gmail dot com | Date: | Tue, 03 Apr 2012 16:27:47 +0000 |
| Subject: | Bug #61240 [Com]: curl_multi_select cause cpu load 100% | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-169201@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61240&edit=1
ID: 61240
Comment by: bompus at gmail 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:
Related to 60790 and 61141
Previous Comments:
------------------------------------------------------------------------
[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:
<?php
// create both cURL resources
$ch1 = curl_init();
$ch2 = curl_init();
// set URL and other appropriate options
curl_setopt($ch1, CURLOPT_URL, "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