Edit report at https://bugs.php.net/bug.php?id=70425&edit=1
ID: 70425
Comment by: carlos dot buenosvinos at gmail dot com
Reported by: cyberline@php.net
Summary: Multicurl runs forever with PHP >= 5.6
Status: Open
Type: Bug
Package: cURL related
Operating System: Irrelevant
PHP Version: 5.6.12
Block user comment: N
Private report: N
New Comment:
It an issue already discussed, please see https://bugs.php.net/bug.php?id=63411
Previous Comments:
------------------------------------------------------------------------
[2015-09-16 18:14:30] apringle at gmail dot com
I ran into this when testing a PHP 5.6.13 system. However, I then noticed the same behavior
happening on a system running PHP 5.5.27. This particular system had a newer version of libcurl
installed. Downgrading to the libcurl (7.19) provided by my CentOS distro fixed the behavior.
Using the test case provided in the bug report, here are the results from some different platforms I
was able to test on:
Centos6.6, PHP 5.5.27, libcurl-7.19.7-46: HTML response shown in output
Centos6.6, PHP 5.5.27, libcurl-7.29: Hangs until execution timeout
Debian8, PHP 5.5.29, libcurl-7.38.0-4: Hangs until execution timeout
Debian8, PHP 5.6.13, libcurl-7.38.0-4: Hangs until execution timeout
OSX 10.10.5, PHP 5.5.7, libcurl 7.43.0: Hangs until execution timeout
------------------------------------------------------------------------
[2015-09-04 09:15:33] cyberline@php.net
Description:
------------
If you use multicurl simmilar to the sample mentioned here:
http://php.net/manual/en/function.curl-multi-init.php
your code will run forever or reach max_execution_time.
Test script:
---------------
<?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);
Expected result:
----------------
HTML of both URL's
Actual result:
--------------
Nothing happens.
strace output shows endless:
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
select(5, [], [4], [], {1, 0}) = 1 (out [4], left {0, 999999})
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70425&edit=1