Bug #70425 [NEW]: Multicurl runs forever with PHP >= 5.6

From: Date: Fri, 04 Sep 2015 09:15:37 +0000
Subject: Bug #70425 [NEW]: Multicurl runs forever with PHP >= 5.6
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195751@lists.php.net to get a copy of this message
From:             cyberline
Operating system: Irrelevant
PHP version:      5.6.12
Package:          cURL related
Bug Type:         Bug
Bug description:Multicurl runs forever with PHP >= 5.6

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 bug report at https://bugs.php.net/bug.php?id=70425&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70425&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70425&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70425&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70425&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70425&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70425&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70425&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70425&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70425&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70425&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70425&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70425&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70425&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70425&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70425&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70425&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70425&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70425&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70425&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70425&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#195751) next »