#34420 [Fbk->Opn]: curl_multi causes segfault

From: Date: Thu, 08 Sep 2005 14:09:12 +0000
Subject: #34420 [Fbk->Opn]: curl_multi causes segfault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84731@lists.php.net to get a copy of this message
ID: 34420 User updated by: blucasco at gmail dot com Reported By: blucasco at gmail dot com -Status: Feedback +Status: Open Bug Type: cURL related Operating System: i386 SuSE 9.1 Pro PHP Version: 5CVS-2005-09-08 (CVS) New Comment: Second run (added CURLOPT_DNS_USE_GLOBAL_CACHE, 0): Program received signal SIGSEGV, Segmentation fault. 0x0808ce0f in zif_curl_setopt (ht=3, return_value=0x86cbc8c, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at /root/disks/src/php5-200509080230/ext/curl/interface.c:1066 1066 ch->handlers->write->method = PHP_CURL_RETURN; First run (CURLOPT_DNS_USE_GLOBAL_CACHE, 1): Reading symbols from /lib/libcrypt.so.1...done. Loaded symbols for /lib/libcrypt.so.1 Reading symbols from /lib/libz.so.1...done. Loaded symbols for /lib/libz.so.1 Reading symbols from /lib/libresolv.so.2...done. Loaded symbols for /lib/libresolv.so.2 Reading symbols from /lib/tls/libm.so.6...done. Loaded symbols for /lib/tls/libm.so.6 Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/libnsl.so.1...done. Loaded symbols for /lib/libnsl.so.1 Reading symbols from /usr/lib/libcurl.so.3...done. Loaded symbols for /usr/lib/libcurl.so.3 Reading symbols from /usr/lib/libidn.so.11...done. Loaded symbols for /usr/lib/libidn.so.11 Reading symbols from /usr/lib/libssl.so.0.9.7...done. Loaded symbols for /usr/lib/libssl.so.0.9.7 Reading symbols from /usr/lib/libcrypto.so.0.9.7...done. Loaded symbols for /usr/lib/libcrypto.so.0.9.7 Reading symbols from /usr/lib/libxml2.so.2...done. Loaded symbols for /usr/lib/libxml2.so.2 Reading symbols from /lib/tls/libc.so.6...done. Loaded symbols for /lib/tls/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /lib/libnss_files.so.2...done. Loaded symbols for /lib/libnss_files.so.2 Reading symbols from /lib/libnss_dns.so.2...done. Loaded symbols for /lib/libnss_dns.so.2 #0 0x0808ce0f in zif_curl_setopt (ht=3, return_value=0x86cbae4, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at /root/disks/src/php5-200509080230/ext/curl/interface.c:1066 1066 ch->handlers->write->method = PHP_CURL_RETURN; Previous Comments: ------------------------------------------------------------------------ [2005-09-08 07:29:57] sniper@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. ------------------------------------------------------------------------ [2005-09-08 06:54:01] blucasco at gmail dot com Also, I have tried with both curl 7.13.x and 7.14.1 compiled in (separate builds) with the same type of seg-fault after several iterations. ------------------------------------------------------------------------ [2005-09-08 06:47:23] blucasco at gmail dot com Description: ------------ This code causes seg fault on any version of PHP 5, including newest CVS build (php5-200509080230). Are there threading issues? Is curl_multi not reliable? I seem unable to test with --enable-thread-safety or --enable-experimental-zts (doesn't compile in properly) so I can't confirm. Reproduce code: --------------- <?php $connomains = array( "http://www.cnn.com/", "http://www.canada.com/", "http://www.yahoo.com/" ); while(1) { $mh = curl_multi_init(); foreach ($connomains as $i => $url) { $conn[$i] = curl_init($url); curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1); curl_multi_add_handle ($mh,$conn[$i]); } // start performing the request do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active and $mrc == CURLM_OK) { // wait for network if (curl_multi_select($mh) != -1) { // pull in any new data, or at least handle timeouts do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } if ($mrc != CURLM_OK) { print "Curl multi read error $mrc\n"; } // retrieve data foreach ($connomains as $i => $url) { if (($err = curl_error($conn[$i])) == '') { $res[$i]=curl_multi_getcontent($conn[$i]); } else { print "Curl error on handle $i: $err\n"; } curl_multi_remove_handle($mh,$conn[$i]); curl_close($conn[$i]); } curl_multi_close($mh); print_r($res); } ?> Expected result: ---------------- Expected: continous loop after everything is properly closed. Actual result: -------------- Segmentation fault ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34420&edit=1

« previous php.bugs (#84731) next »