php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33560 curl_multi handle not being properly destroyed - seg faults if reused
Submitted: 2005-07-04 03:38 UTC Modified: 2005-07-12 01:00 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:3 (75.0%)
From: eja40 at cam dot ac dot uk Assigned:
Status: No Feedback Package: cURL related
PHP Version: 5.0.4 OS: Redhat 9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: eja40 at cam dot ac dot uk
New email:
PHP Version: OS:

 

 [2005-07-04 03:38 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-04 09:43 UTC] sniper@php.net
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


 [2005-07-12 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC