From:             eja40 at cam dot ac dot uk
Operating system: Redhat 9
PHP version:      5.0.4
PHP Bug Type:     cURL related
Bug description:  curl_multi handle not being properly destroyed - seg faults 
if reused

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 bug report at http://bugs.php.net/?id=33560&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33560&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33560&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33560&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33560&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33560&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33560&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33560&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33560&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33560&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33560&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33560&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33560&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33560&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33560&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33560&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33560&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33560&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33560&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33560&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33560&r=mysqlcfg

Reply via email to