php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35570 segfault when re-using soap client object
Submitted: 2005-12-06 13:53 UTC Modified: 2005-12-12 17:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rick at revenew dot nl Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5CVS-2005-12-06 (snap) OS: Debian Sarge (Linux) amd64
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rick at revenew dot nl
New email:
PHP Version: OS:

 

 [2005-12-06 13:53 UTC] rick at revenew dot nl
Description:
------------
The first method I call on a soap client object works fine. The second call however, produces a segfault. When I recreate the soap client object in between the calls the script works fine. This bug also occurs in PHP 5.0.4 and 5.0.5. But it didn't exist on my previous i386 Debian woody server (the php code is identical). 

Reproduce code:
---------------
$wq = new SoapClient('http://soap-server-ip/WQLogin/wsdl/IWQLoginService');
$ul = $wq->GetUserList();
foreach ($ul as $array) {
  if($array->UserName == $_GET['username']) {
     if($array->Password == $_GET['password']) {
        if(in_array('1',$array->Permissions)) {
           $wq->GetUserUID($array->UserID);

The last line causes the segfault. But when I insert: $wq = new SoapClient('http://soap-server-ip/WQLogin/wsdl/IWQLoginService');
one line before the last, it works fine.

Expected result:
----------------
no segfault ;)

Actual result:
--------------
segfault, haven't got a backtrace yet. Can create one if you require it.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-06 14:10 UTC] rick at revenew dot nl
the latest snapshot still segfaults
 [2005-12-06 14:17 UTC] tony2001@php.net
Please provide BOTH short but complete reproduce script and GDB backtrace.
Thanks.
 [2005-12-06 14:46 UTC] rick at revenew dot nl
Hmm just noticed something really strange. I just recompiled php 5.1.1 with the exact same configure options, only I added --enable-debug to start making a backtrace. Now with the --enable-debug it works fine :S So, I got curious offcourse and recompiled again without --enable-debug and bam... a segfault again.
 [2005-12-06 14:48 UTC] tony2001@php.net
Check it with valgrind. I guess it should give you some warnings or something.
 [2005-12-07 10:29 UTC] rick at revenew dot nl
I can't seem to get valgrind compiled on my system:

/usr/bin/ld: skipping incompatible /usr/lib/gcc-lib/x86_64-linux/3.3.5/./libgcc.a when searching for -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc-lib/x86_64-linux/3.3.5/libgcc.a when searching for -lgcc

Is there another way to find out what the problem is?
 [2005-12-07 10:59 UTC] tony2001@php.net
Well, at least show the GDB backtrace that you get without --enable-debug.
 [2005-12-07 11:48 UTC] rick at revenew dot nl
Also it doesn't matter what the second soap request is. The second one just causes a segfault. In the simplest form:

webserver:~# cat login.php
#!/usr/local/php-5.1.1/bin/php
<?php
$wq = new SoapClient('http://soap-server-ip-address/WQLogin/wsdl/IWQLoginService');
$foo = $wq->GetUserList(); // Soap request 1 works fine
$wq = new SoapClient('http://soap-server-ip-address/WQLogin/wsdl/IWQLoginService');
$bar = $wq->GetUserList(); // Soap request 2 causes segfault, but works fine after a reconnect
?>
webserver:~# ./login.php
webserver:~# vim login.php
webserver:~# cat login.php
#!/usr/local/php-5.1.1/bin/php
<?php
$wq = new SoapClient('http://soap-server-ip-address/WQLogin/wsdl/IWQLoginService');
$foo = $wq->GetUserList(); // Soap request 1 works fine
$bar = $wq->GetUserList(); // Soap request 2 causes segfault, but works fine after a reconnect
?>
webserver:~# ./login.php
Segmentation fault (core dumped)
webserver:~#
 [2005-12-07 11:59 UTC] tony2001@php.net
Looking at the backtrace, it doesn't seem like PHP problem.
What libxml2 version are you using?
 [2005-12-07 12:02 UTC] rick at revenew dot nl
It's the default Debian Sarge (amd64) version: 2.6.16-7.
 [2005-12-07 12:05 UTC] tony2001@php.net
Try to update it and see if it helps.
 [2005-12-07 12:34 UTC] rick at revenew dot nl
I updated to the latest libxml2 (2.6.22) and recompiled php with this lib. And it still segfaults. Here is a backtrace from this version:


#0  0x0000000000000000 in ?? ()
#1  0x0000000000000003 in ?? ()
#2  0x0000000000000000 in ?? ()
#3  0x0000000000000000 in ?? ()
#4  0x00000000000001cf in ?? ()
#5  0x00007ffffff722b0 in ?? ()
#6  0x00000000acb04e21 in ?? ()
#7  0x00000001000000c8 in ?? ()
#8  0x00002aaaacb04e21 in sbrk () from /lib/libc.so.6
#9  0x0000000000d57640 in ?? ()
#10 0x0000000100000000 in ?? ()
#11 0x0000000000d3fdf8 in ?? ()
#12 0x0000000000d57640 in ?? ()
#13 0x0000000000d34e98 in ?? ()
#14 0x0000000000d3b1c4 in ?? ()
#15 0x0000000000000005 in ?? ()
#16 0x0000000000d39c00 in ?? ()
#17 0x0000000000000000 in ?? ()
#18 0x0000000000000000 in ?? ()
#19 0x00002aaaacaafff7 in malloc () from /lib/libc.so.6
#20 0x00002aaaac8a97c8 in xmlStrndup () from /usr/lib/libxml2.so.2
#21 0x00002aaaac8a9824 in xmlStrdup () from /usr/lib/libxml2.so.2
#22 0x00002aaaac8643a3 in xmlNewNode () from /usr/lib/libxml2.so.2
#23 0x00002aaaac8644cc in xmlNewDocNode () from /usr/lib/libxml2.so.2
#24 0x00002aaaac8e19e8 in xmlSAX2StartElementNs () from /usr/lib/libxml2.so.2
#25 0x00002aaaac8a97c8 in xmlStrndup () from /usr/lib/libxml2.so.2
#26 0x00002aaaac8e103f in xmlSAX2EndElement () from /usr/lib/libxml2.so.2
#27 0x00002aaaac8e1b68 in xmlSAX2EndElementNs () from /usr/lib/libxml2.so.2
#28 0x0000000000021000 in ?? ()
#29 0x00002aaaacc74580 in __after_morecore_hook () from /lib/libc.so.6
#30 0x00002aaaacab4079 in __default_morecore () from /lib/libc.so.6
#31 0x0000000000000000 in ?? ()
#32 0x0000000000000000 in ?? ()
#33 0x0000000000000004 in ?? ()
#34 0x0000000000d23f00 in ?? ()
#35 0x000000000069c8a2 in zend_parse_va_args (num_args=4, type_spec=0x8b9adc "", va=0xd59820, flags=-1397736960)
    at /home/rick/php-5.1.1/Zend/zend_API.c:608
#36 0x000000000069ca8a in zend_parse_parameters (num_args=-581848, type_spec=0x1 <Address 0x1 out of bounds>)
    at /home/rick/php-5.1.1/Zend/zend_API.c:635
#37 0x000000000058628c in zif_SoapClient___doRequest (ht=-581848, return_value=0xe683c8, return_value_ptr=0x0, this_ptr=0xd34e98,
    return_value_used=13888920) at /home/rick/php-5.1.1/ext/soap/soap.c:2722
#38 0x0000000000690d01 in zend_call_function (fci=0x7ffffff72490, fci_cache=0x4) at /home/rick/php-5.1.1/Zend/zend_execute_API.c:894
#39 0x00000000006906b6 in call_user_function_ex (function_table=0x7ffffff71f28, object_pp=0x1, function_name=0x0,
    retval_ptr_ptr=0x2aaaacb03a00, param_count=13888920, params=0xd3a208, no_separation=1, symbol_table=0x1)
    at /home/rick/php-5.1.1/Zend/zend_execute_API.c:578
#40 0x00000000006905a2 in call_user_function (function_table=0x0, object_pp=0x7ffffff72560, function_name=0x7ffffff72620,
    retval_ptr=0x7ffffff72830, param_count=4, params=0x7ffffff72580) at /home/rick/php-5.1.1/Zend/zend_execute_API.c:551
#41 0x00000000005847e2 in do_request (this_ptr=0xd34e98, request=0x7ffffff71f28,
    location=0xca7128 "http://soap-server-ip-address/WQLogin/soap/IWQLoginService",
    action=0xd3fdf8 "urn:WQLoginServiceIntf-IWQLoginService#GetUserList", version=1, response=0x7ffffff72830)
    at /home/rick/php-5.1.1/ext/soap/soap.c:2273
#42 0x0000000000584e43 in do_soap_call (this_ptr=0xd34e98, function=0xca6648 "GetUserList", function_len=0, arg_count=0, real_args=0x0,
    return_value=0xd3a1c8, location=0xca7128 "http://soap-server-ip-address/WQLogin/soap/IWQLoginService", soap_action=0x0, call_uri=0x0,
    soap_headers=0x0, output_headers=0x0) at /home/rick/php-5.1.1/ext/soap/soap.c:2375
#43 0x0000000000585c4f in zif_SoapClient___call (ht=-581848, return_value=0xd3a1c8, return_value_ptr=0x0, this_ptr=0xd34e98,
    return_value_used=13888920) at /home/rick/php-5.1.1/ext/soap/soap.c:2584
#44 0x0000000000690d01 in zend_call_function (fci=0x7ffffff72ad0, fci_cache=0x2) at /home/rick/php-5.1.1/Zend/zend_execute_API.c:894
#45 0x00000000006ab38b in zend_call_method (object_pp=0x7ffffff72b90, obj_ce=0xcb0840, fn_proxy=0xcb0a20, function_name=0x8c85e0 "__call",
    function_name_len=6, retval_ptr_ptr=0x7ffffff72b98, param_count=1, arg1=0xca66e8, arg2=0xca5ae8)
    at /home/rick/php-5.1.1/Zend/zend_interfaces.c:88
#46 0x00000000006b157e in zend_std_call_user_call (ht=13264616, return_value=0xca64b8, return_value_ptr=0x0, this_ptr=0xd34e98,
    return_value_used=13888920) at /home/rick/php-5.1.1/Zend/zend_object_handlers.c:634
#47 0x00000000006bfac9 in zend_do_fcall_common_helper_SPEC (execute_data=0x7ffffff72df0) at zend_vm_execute.h:188
#48 0x00000000006bf394 in execute (op_array=0xca5958) at zend_vm_execute.h:88
#49 0x000000000069b439 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/rick/php-5.1.1/Zend/zend.c:1090
#50 0x00000000006624e2 in php_execute_script (primary_file=0x7ffffff75440) at /home/rick/php-5.1.1/main/main.c:1704
#51 0x000000000070a9c6 in main (argc=2, argv=0x7ffffff755b8) at /home/rick/php-5.1.1/sapi/cli/php_cli.c:1039
 [2005-12-07 17:57 UTC] iliaa@php.net
Can you provide the WSDL file in question. I tried to replicate the problem with generic WSDL files from 2 provides and 2nd request is being processed without a problem.
 [2005-12-08 09:13 UTC] rick at revenew dot nl
Iliaa, the WSDL file is in your email. Couldn't post it here, the bug systems says it is spam :)
 [2005-12-12 10:27 UTC] dmitry@php.net
Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.
 [2005-12-12 17:01 UTC] rick at revenew dot nl
Just upgraded and it works fine now. Thanks a lot!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 19:01:31 2024 UTC