Edit report at https://bugs.php.net/bug.php?id=63411&edit=1
ID: 63411
Comment by: bfanger at gmail dot com
Reported by: marcel at silverstreet dot com
Summary: curl_multi_select() returns invalid value
Status: Feedback
Type: Bug
Package: cURL related
Operating System: CentOS 6.3
PHP Version: 5.3.18
Assigned To: pierrick
Block user comment: N
Private report: N
New Comment:
curl_multi_select() returning -1 has been an issue for windows versions of PHP
for a while:
https://bugs.php.net/bug.php?id=61141
A workaround for my Curl wrapper class was to rewrite:
if (curl_multi_select(self::$pool, 0.2) === -1) {
throw new \Exception('Failed to detect changes in the cURL multi handle');
}
To:
if (curl_multi_select(self::$pool, 0.2) === -1) {
usleep(100000); // wait 0.1 second
}
PS:
When are you going to introduce the new curl_multi_wait function to php?
Previous Comments:
------------------------------------------------------------------------
[2012-11-15 09:30:31] bfanger at gmail dot com
It breaks all my testcases in PHP 5.4.8 (works fine in 5.4.7)
$ git clone git://github.com/sledgehammer/core.git testapp/core
$ phpunit --bootstrap testapp/core/phpunit_bootstrap.php
testapp/core/tests/CurlTest.php
------------------------------------------------------------------------
[2012-11-15 05:39:33] pierrick@php.net
Does it break all the test cases ? Or only like in your case when you have no
handle ?
------------------------------------------------------------------------
[2012-11-05 15:21:29] aa dot vasilenko at gmail dot com
This bug breaks existing libs, like Buzz https://github.com/kriswallsmith/Buzz ,
that relies on curl_multi_* functions. This is how I came here.
------------------------------------------------------------------------
[2012-11-03 03:42:09] pierrick@php.net
I'm not sure we really want to wait 1 second for nothing in this specific case.
Furthermore, as mentioned in my commit message, when libcurl returns -1 in
max_fd after calling curl_multi_fdset, it is because libcurl currently
does something that isn't possible for your application to monitor
with a socket and unfortunately you can then not know exactly when
the current action is completed using select().
I would personally keep the current behaviour.
------------------------------------------------------------------------
[2012-11-02 04:52:57] reeze@php.net
This is related to this
see:
https://github.com/php/php-src/commit/2e8ab65270e7d1ebe1ef0dfe13836c29d72c7010http://curl.haxx.se/libcurl/c/curl_multi_fdset.html
There is no handles in the test script, it is expected after the patch.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=63411--
Edit this bug report at https://bugs.php.net/bug.php?id=63411&edit=1