#33560 [Opn->Fbk]: curl_multi handle not being properly destroyed - seg faults if reused
| From: | sniper@php.net | Date: | Mon, 04 Jul 2005 07:44:00 +0000 |
| Subject: | #33560 [Opn->Fbk]: curl_multi handle not being properly destroyed - seg faults if reused | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81350@lists.php.net to get a copy of this message | ||
ID: 33560
Updated by: sniper@php.net
Reported By: eja40 at cam dot ac dot uk
-Status: Open
+Status: Feedback
Bug Type: cURL related
Operating System: Redhat 9
PHP Version: 5.0.4
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-07-04 03:38:56] eja40 at cam dot ac dot uk
Description:
------------
Irregularly, multi-curl functions will give a seg fault. Appears to be
due to reuse of handles.
Reproduce code:
---------------
$mh = curl_multi_init();
unset($this->connections);
// setup connections here
// exec curl connections here, get data out
// then remove the connections using this:
curl_multi_remove_handle($mh,$this->connections[$i]);
curl_multi_close($mh);
When I establish a second round of connections using the same variable
name, $this->connections[$i] - there can be a segmentation fault.
It crashes on the curl_setopt line of this:
$this->connections[$i] = curl_init($url['URL']);
curl_setopt($this->connections[$i], CURLOPT_RETURNTRANSFER,1);
Expected result:
----------------
Shouldn't crash!
Appears that it can be worked around by adding an additional
unset($this->connections); directly after curl_multi_close($mh);
Actual result:
--------------
Segmentation fault ( - erratically reproducible with my very
complicated code)..
Backtrace:
#0 0x080a0529 in zif_curl_setopt (ht=3, return_value=0x85feb9c,
this_ptr=0x0, return_value_used=0)
at /home/admin/php-5.0.4/ext/curl/interface.c:1040
#1 0x08201746 in zend_do_fcall_common_helper (execute_data=0xbfff9c90,
opline=0x85c9f20, op_array=0x85be5f4)
at /home/admin/php-5.0.4/Zend/zend_execute.c:2727
#2 0x081fed42 in execute (op_array=0x85be5f4) at
/home/admin/php-5.0.4/Zend/zend_execute.c:1406
#3 0x0820155e in zend_do_fcall_common_helper (execute_data=0xbfffb700,
opline=0x85c33e0, op_array=0x85bbb1c)
at /home/admin/php-5.0.4/Zend/zend_execute.c:2756
#4 0x081fed42 in execute (op_array=0x85bbb1c) at
/home/admin/php-5.0.4/Zend/zend_execute.c:1406
#5 0x0820155e in zend_do_fcall_common_helper (execute_data=0xbfffbb00,
opline=0x85ba58c, op_array=0x85b57d4)
at /home/admin/php-5.0.4/Zend/zend_execute.c:2756
#6 0x081fed42 in execute (op_array=0x85b57d4) at
/home/admin/php-5.0.4/Zend/zend_execute.c:1406
#7 0x081e4c17 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/admin/php-5.0.4/Zend/zend.c:1069
#8 0x081b793b in php_execute_script (primary_file=0xbfffdec0) at
/home/admin/php-5.0.4/main/main.c:1632
#9 0x08208060 in main (argc=3, argv=0xbfffdf44) at
/home/admin/php-5.0.4/sapi/cli/php_cli.c:946
#10 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33560&edit=1