Edit report at https://bugs.php.net/bug.php?id=63411&edit=1
ID: 63411 Comment by: yang dot phpbugs at mailnull dot com Reported by: marcel at silverstreet dot com Summary: curl_multi_select() returns invalid value Status: No 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: I'm also finding this to be breaking various libraries including JAXL. Previous Comments: ------------------------------------------------------------------------ [2013-03-13 12:14:39] qu...@php.net What's the point of a select() call that doesn't block? The whole point of curl_multi_select is to block until either there's some activity on the socket, or the timeout is reached. The curl_multi_select() call now returns immediately (with -1), without waiting for the timeout, in all our use cases too, making it useless. Why was the behaviour changed in the first place? Is it possible to revert? ------------------------------------------------------------------------ [2013-02-18 00:36:04] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2012-12-31 23:04:18] mail+php at requinix dot net Related To: Bug #63842 ------------------------------------------------------------------------ [2012-11-15 13:54:10] pierr...@php.net As mentioned in bug #61141, curl_multi_select() returning -1 is an expected behaviour and you should not throw an exception which prevent your call to be done. Internally php curl_multi_select uses libcurl curl_multi_fdset function to set all the fd_set and the maxfd value. The libcurl curl_multi_fdset documentation says : When libcurl returns -1 in max_fd, 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(). When max_fd returns with -1, you need to wait a while and then proceed and call curl_multi_perform anyway. How long to wait? I would suggest 100 milliseconds at least, but you may want to test it out in our own particular conditions to find a suitable value. The workaround you made is not really a workaround, but is exactly what libcurl recommend you to do in this case :) ------------------------------------------------------------------------ [2012-11-15 11:42:21] bfanger at gmail dot com 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? ------------------------------------------------------------------------ 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