Bug #70060 [Opn->Nab]: write events should be disabled in curl_multi_select

From: Date: Wed, 15 Jul 2015 02:49:31 +0000
Subject: Bug #70060 [Opn->Nab]: write events should be disabled in curl_multi_select
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194447@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70060&edit=1 ID: 70060 Updated by: laruence@php.net Reported by: xiaoyjy at mail dot com Summary: write events should be disabled in curl_multi_select -Status: Open +Status: Not a bug Type: Bug Package: cURL related Operating System: Linux PHP Version: 5.6.11 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2015-07-13 09:07:23] laruence@php.net I don't think this is a bug, as described here: http://curl.haxx.se/libcurl/c/curl_multi_fdset.html "This function extracts file descriptor information from a given multi_handle. libcurl returns its fd_set sets. The application can use these to select() on, but be sure to FD_ZERO them before calling this function as curl_multi_fdset only adds its own descriptors, it doesn't zero or otherwise remove any others. The curl_multi_perform function should be called as soon as one of them is ready to be read from or written to." that means, the write event is interested by libcurl, the requests are not sent completely yet. so, you should use a while loop, if the state changed, you should call curl_multi_exec immedidately and always checking running request in the mean time to achieve your goals thanks ------------------------------------------------------------------------ [2015-07-13 08:06:22] xiaoyjy at mail dot com change Package to cURL ralated ------------------------------------------------------------------------ [2015-07-13 07:57:22] xiaoyjy at mail dot com Description: ------------ As a clent fd, writefds are always available, the select function will always return immediately if the writefds is enabled. but we only care about read events in this case. PHP_FUNCTION(curl_multi_select) { zval *z_mh; php_curlm *mh; fd_set readfds; fd_set writefds; fd_set exceptfds; int maxfd; double timeout = 1.0; struct timeval to; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|d", &z_mh, &timeout) == FAILURE) { return; } ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle); _make_timeval_struct(&to, timeout); FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds); curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd); if (maxfd == -1) { RETURN_LONG(-1); } RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70060&edit=1

« previous php.bugs (#194447) next »