Edit report at http://bugs.php.net/bug.php?id=52284&edit=1
ID: 52284 Updated by: il...@php.net Reported by: ahar...@php.net Summary: Reproducible crash using curl_multi functions with FTP -Status: Verified +Status: Bogus Type: Bug Package: cURL related Operating System: Ubuntu 10.04 (and others) PHP Version: 5.3SVN-2010-07-08 (SVN) Block user comment: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Not a PHP bug, the issue exists within libcurl. Previous Comments: ------------------------------------------------------------------------ [2010-07-28 16:22:10] profy dot net at gmail dot com I think recompile will help. But I prefer to use distro's php versions for maintainability. We use several ubuntu versions in production. Anyway, I added workaround in my code to switch into one-thread mode when dealing with FTP urls while bug still exists in packaged php5-curl extension. ------------------------------------------------------------------------ [2010-07-27 17:18:14] paj...@php.net @srinata I don't think there is a release after 7.21.0. We have to wait for it :) ------------------------------------------------------------------------ [2010-07-27 16:49:14] srina...@php.net Ok, been debugging this since morning for fun. As Pierre mentioned earlier, this bug turns out to be a libcurl bug and a recent commit within libcurl fixes the underlying multi handler issue. now, ubuntu has not shipped with recent versions of libcurl yet. so, you will need to manually download libcurl from below: and install to say /usr/local http://curl.haxx.se/snapshots/ once this new curl is installed, you will need to recompile php with --with- curl=/usr/local if this satisfies ur concern, then we can close this bug. hope this helps. ------------------------------------------------------------------------ [2010-07-27 07:48:00] profy dot net at gmail dot com Reproduced every time when call test script. Test script: --------------- <?php function multi_request($urls, $url_options = array()) { $mh = curl_multi_init(); foreach ($urls as $id => $url) { $curly[$id] = curl_init(); curl_setopt($curly[$id], CURLOPT_URL, $url); curl_setopt($curly[$id], CURLOPT_RETURNTRANSFER, true); // I've add this opt to speed up request, bug appearing with or without this line curl_setopt($curly[$id], CURLOPT_NOBODY, true); curl_multi_add_handle($mh, $curly[$id]); } $running = null; do { $status = curl_multi_exec($mh, $running); usleep(1000); } while($status == CURLM_CALL_MULTI_PERFORM || $running); foreach ($curly as $id => $c) { $result[$id] = curl_multi_getcontent($c); curl_multi_remove_handle($mh, $c); curl_close($c); } curl_multi_close($mh); return $result; } $urls = array( "4358521" => "ftp://ftp.ea.com/pub/ea/patches/nfs-underground/pc/en-uk/NFSU_EUROPE_PATCH_4.exe", "7458288" => "ftp://ftp.nero.com/software/plugins/WMAPlugin20937.exe", ); echo "<pre>"; print_R(multi_request($urls)); echo "</pre>"; ------------------------------------------------------------------------ [2010-07-27 04:57:11] srina...@php.net able to reproduce this issue. here is the stack trace: (gdb) where #0 0x0000000000520a58 in curl_write_header (data=0x18d3b78 "221 Goodbye.\r\nomplete.\r", size=1, nmemb=14, ctx=0x1876e58) at /home/sriramn/dev/php-src/branches/PHP_5_3/ext/curl/interface.c:1123 #1 0x00007f106e187c26 in ?? () from /usr/lib/libcurl.so.4 #2 0x00007f106e1885ad in ?? () from /usr/lib/libcurl.so.4 #3 0x00007f106e18b2ed in ?? () from /usr/lib/libcurl.so.4 #4 0x00007f106e18c64f in ?? () from /usr/lib/libcurl.so.4 #5 0x00007f106e18c792 in ?? () from /usr/lib/libcurl.so.4 #6 0x00007f106e18e9b2 in ?? () from /usr/lib/libcurl.so.4 #7 0x00007f106e1a4813 in curl_multi_cleanup () from /usr/lib/libcurl.so.4 #8 0x0000000000527208 in _php_curl_multi_close (rsrc=0x1871970) at /home/sriramn/dev/php-src/branches/PHP_5_3/ext/curl/multi.c:327 #9 0x00000000007f246e in list_entry_destructor (ptr=0x1871970) at /home/sriramn/dev/php-src/branches/PHP_5_3/Zend/zend_list.c:184 #10 0x00000000007efa3b in zend_hash_del_key_or_index (ht=0xe1eaf0, arKey=0x0, nKeyLength=0, h=4, flag=1) at /home/sriramn/dev/php-src/branches/PHP_5_3/Zend/zend_hash.c:497 #11 0x00000000007f1fa0 in _zend_list_delete (id=4) at /home/sriramn/dev/php-src/branches/PHP_5_3/Zend/zend_list.c:58 #12 0x00000000005271d5 in zif_curl_multi_close (ht=1, return_value=0x187a140, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at /home/sriramn/dev/php-src/branches/PHP_5_3/ext/curl/multi.c:319 ------------------------------------------------------------------------ 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 http://bugs.php.net/bug.php?id=52284 -- Edit this bug report at http://bugs.php.net/bug.php?id=52284&edit=1