#34420 [Opn]: curl_multi causes segfault
| From: | blucasco at gmail dot com | Date: | Thu, 08 Sep 2005 05:12:34 +0000 |
| Subject: | #34420 [Opn]: curl_multi causes segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84679@lists.php.net to get a copy of this message | ||
ID: 34420
User updated by: blucasco at gmail dot com
-Summary: Problem with negative exponent handling
Reported By: blucasco at gmail dot com
Status: Open
Bug Type: Reproducible crash
Operating System: i386 SuSE 9.1 Pro
PHP Version: 5CVS-2005-09-08 (CVS)
New Comment:
title change
Previous Comments:
------------------------------------------------------------------------
[2005-09-08 06:54:01] blucasco at gmail dot com
Also, I have tried with both curl 7.13.x and 7.14.1 compiled in
(separate builds) with the same type of seg-fault after several
iterations.
------------------------------------------------------------------------
[2005-09-08 06:47:23] blucasco at gmail dot com
Description:
------------
This code causes seg fault on any version of PHP 5, including newest
CVS build (php5-200509080230).
Are there threading issues? Is curl_multi not reliable?
I seem unable to test with --enable-thread-safety or
--enable-experimental-zts (doesn't compile in properly) so I can't
confirm.
Reproduce code:
---------------
<?php
$connomains = array(
"http://www.cnn.com/",
"http://www.canada.com/",
"http://www.yahoo.com/"
);
while(1) {
$mh = curl_multi_init();
foreach ($connomains as $i => $url) {
$conn[$i] = curl_init($url);
curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1);
curl_multi_add_handle ($mh,$conn[$i]);
}
// start performing the request
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active and $mrc == CURLM_OK) {
// wait for network
if (curl_multi_select($mh) != -1) {
// pull in any new data, or at least handle timeouts
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
if ($mrc != CURLM_OK) {
print "Curl multi read error $mrc\n";
}
// retrieve data
foreach ($connomains as $i => $url) {
if (($err = curl_error($conn[$i])) == '') {
$res[$i]=curl_multi_getcontent($conn[$i]);
} else {
print "Curl error on handle $i: $err\n";
}
curl_multi_remove_handle($mh,$conn[$i]);
curl_close($conn[$i]);
}
curl_multi_close($mh);
print_r($res);
}
?>
Expected result:
----------------
Expected: continous loop after everything is properly closed.
Actual result:
--------------
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34420&edit=1