Bug #71931 [Com]: Soap cache_wsdl WSDL_CACHE_MEMORY option on CLI

From: Date: Wed, 02 Nov 2016 22:49:45 +0000
Subject: Bug #71931 [Com]: Soap cache_wsdl WSDL_CACHE_MEMORY option on CLI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205160@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71931&edit=1

 ID:                 71931
 Comment by:         gcarrette at wayfair dot com
 Reported by:        nikspijkerman at gmail dot com
 Summary:            Soap cache_wsdl WSDL_CACHE_MEMORY option on CLI
 Status:             Open
 Type:               Bug
 Package:            SOAP related
 Operating System:   Ubuntu 14.04
 PHP Version:        7.0.4
 Block user comment: N
 Private report:     N

 New Comment:

Here is a self-contained simple script you can use to reproduce this at will.
The script was derived from a bug report 50722, but adds a real wsdl reference url. I also get the
same error in a more complex application, with only 1 wsdl
file. The work around is to stick with WSDL_CACHE_DISK and avoid MEMORY/BOTH.

$wsdl_url = 'https://webservices.sandbox.netsuite.com/wsdl/v2013_2_0/netsuite.wsdl';

$wsdl_xml = file_get_contents($wsdl_url);

for($j = 1; $j <= 6; $j++) {
 $status = file_put_contents("wsdl-file-$j.wsdl", $wsdl_xml);
 if ($status === false) {
   echo "ERROR: Failed to write wsdl-file-$j.wsdl\n";
 }
}

ini_set('soap.wsdl_cache_enabled', 1);
ini_set('soap.wsdl_cache', WSDL_CACHE_MEMORY);
ini_set('soap.wsdl_cache_limit', 5); // Note: Cache size of 5.

function test($x)
{
  $client1 = new SoapClient("./wsdl-file-1.wsdl");
  $client2 = new SoapClient("./wsdl-file-2.wsdl");
  $client3 = new SoapClient("./wsdl-file-3.wsdl");
  $client4 = new SoapClient("./wsdl-file-4.wsdl");
  $client5 = new SoapClient("./wsdl-file-5.wsdl");

  return $x; //web server segfaults or corrupt XML returned
}

$server = new SoapServer("./wsdl-file-6.wsdl");
$server->addFunction("test");
$server->handle();

test(null);


Previous Comments:
------------------------------------------------------------------------
[2016-11-02 13:31:10] kevin dot letord at openclassrooms dot com

Still present in 7.0.12 on MacOS X

Process:               php [62107]
Path:                  /usr/local/Cellar/php70/7.0.12_5/bin/php
Identifier:            php
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        zsh [701]
Responsible:           iTerm2 [696]
User ID:               502

Date/Time:             2016-11-02 14:17:24.450 +0100
OS Version:            Mac OS X 10.11.6 (15G1108)
Report Version:        11
Anonymous UUID:        82D86DB1-0CCB-203A-1A50-3F1ED24A48DD


Time Awake Since Boot: 17000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000010d6d6d75

VM Regions Near 0x10d6d6d75:
    VM_ALLOCATE            000000010d200000-000000010d400000 [ 2048K] rw-/rwx SM=PRV  
--> 
    MALLOC_LARGE           000000010e400000-000000010e640000 [ 2304K] rw-/rwx SM=PRV  

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   php                           	0x0000000109f5396c zend_hash_destroy + 348
1   php                           	0x0000000109dcbb43 delete_type_persistent + 342
2   php                           	0x0000000109f53895 zend_hash_destroy + 133
3   php                           	0x0000000109dd424c delete_psdl_int + 105
4   php                           	0x0000000109dd407a delete_psdl + 17
5   php                           	0x0000000109f53962 zend_hash_destroy + 338
6   php                           	0x0000000109da71b6 zm_shutdown_soap + 82
7   php                           	0x0000000109f4c1c7 module_destructor + 117
8   php                           	0x0000000109f43e5e module_destructor_zval + 17
9   php                           	0x0000000109f531e8 _zend_hash_del_el_ex + 308
10  php                           	0x0000000109f544d1 zend_hash_graceful_reverse_destroy + 175
11  php                           	0x0000000109f43fe5 zend_shutdown + 225
12  php                           	0x0000000109ee7117 php_module_shutdown + 42
13  php                           	0x0000000109fd1ff4 main + 1381
14  libdyld.dylib                 	0x00007fff8c3e55ad start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007fff7989f420  rbx: 0x0000010000000000  rcx: 0x00000000001f8100  rdx: 0x0000000000132480
  rdi: 0x000000010d6d6d70  rsi: 0x000000010abe9200  rbp: 0x00007fff560e5d10  rsp: 0x00007fff560e5ce0
   r8: 0x0000000000000000   r9: 0x00007faa79c2be80  r10: 0x000000008c2dd4b2  r11: 0x00007faa79c00000
  r12: 0x00007faa7a03fa80  r13: 0x000000010a532db2  r14: 0x00007faa79c78fc0  r15: 0x00007faa7a03fe20
  rip: 0x0000000109f5396c  rfl: 0x0000000000010202  cr2: 0x000000010d6d6d75
  
Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14


lldb

(lldb) bt
* thread #1: tid = 0x442c0, 0x00007fff9c37d8ea libsystem_kernel.dylib`__kill + 10, queue =
'com.apple.main-thread', stop reason = signal SIGSEGV
  * frame #0: 0x00007fff9c37d8ea libsystem_kernel.dylib`__kill + 10
    frame #1: 0x0000000101dcc1cb php`zend_mm_panic + 52
    frame #2: 0x0000000101dcd2a2 php`zend_mm_free_heap + 733
    frame #3: 0x0000000101e0099b php`zend_hash_destroy + 395
    frame #4: 0x0000000101c78b43 php`delete_type_persistent + 342
    frame #5: 0x0000000101e00895 php`zend_hash_destroy + 133
    frame #6: 0x0000000101c8124c php`delete_psdl_int + 105
    frame #7: 0x0000000101c8107a php`delete_psdl + 17
    frame #8: 0x0000000101e00962 php`zend_hash_destroy + 338
    frame #9: 0x0000000101c541b6 php`zm_shutdown_soap + 82
    frame #10: 0x0000000101df91c7 php`module_destructor + 117
    frame #11: 0x0000000101df0e5e php`module_destructor_zval + 17
    frame #12: 0x0000000101e001e8 php`_zend_hash_del_el_ex + 308
    frame #13: 0x0000000101e014d1 php`zend_hash_graceful_reverse_destroy + 175
    frame #14: 0x0000000101df0fe5 php`zend_shutdown + 225
    frame #15: 0x0000000101d94117 php`php_module_shutdown + 42
    frame #16: 0x0000000101e7eff4 php`main + 1381
    frame #17: 0x00007fff8c3e55ad libdyld.dylib`start + 1
    frame #18: 0x00007fff8c3e55ad libdyld.dylib`start + 1

------------------------------------------------------------------------
[2016-10-20 07:00:03] fedoreyev at gmail dot com

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /opt/php-7.1.0d/bin/php...done.

warning: core file may not match specified executable file.
[New LWP 21224]
Missing separate debuginfo for /lib64/libmysqlclient.so.18
Try: yum --enablerepo='*debug*' install
/usr/lib/debug/.build-id/97/92a5f335292ffd1eca1fefeb50672acaae2e07.debug
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/opt/php-7.1.0d/bin/php /home/vlru/adventure/app/console_test yading
--env=dr'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000a2464d in zend_string_release (s=0x7f4ceb3be9b0) at
/usr/local/src/php-7.1.0RC4/Zend/zend_string.h:270
270		if (!ZSTR_IS_INTERNED(s)) {
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-20.el7_2.x86_64
freetype-2.4.11-11.el7.x86_64 glibc-2.17-106.el7_2.8.x86_64 keyutils-libs-1.5.8-3.el7.x86_64
krb5-libs-1.13.2-12.el7_2.x86_64 libcom_err-1.42.9-7.el7.x86_64 libcurl-7.29.0-25.el7.centos.x86_64
libgcc-4.8.5-4.el7.x86_64 libgcrypt-1.5.3-12.el7_1.1.x86_64 libgpg-error-1.12-3.el7.x86_64
libidn-1.28-4.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libmcrypt-2.5.8-13.el7.x86_64
libpng-1.5.13-7.el7_2.x86_64 libselinux-2.2.2-6.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64
libstdc++-4.8.5-4.el7.x86_64 libtidy-0.99.0-31.20091203.el7.x86_64 libxml2-2.9.1-6.el7_2.3.x86_64
libxslt-1.1.28-5.el7.x86_64 nspr-4.11.0-1.el7_2.x86_64 nss-3.21.0-9.el7_2.x86_64
nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64 nss-util-3.21.0-2.2.el7_2.x86_64
openldap-2.4.40-9.el7_2.x86_64 openssl-libs-1.0.1e-51.el7_2.5.x86_64 pcre-8.32-15.el7_2.1.x86_64
xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) bt
#0  0x0000000000a2464d in zend_string_release (s=0x7f4ceb3be9b0) at
/usr/local/src/php-7.1.0RC4/Zend/zend_string.h:270
#1  0x0000000000a287af in zend_hash_destroy (ht=0x1bbd2f0) at
/usr/local/src/php-7.1.0RC4/Zend/zend_hash.c:1251
#2  0x00000000007e3727 in delete_type_persistent (zv=0x1b8eb18) at
/usr/local/src/php-7.1.0RC4/ext/soap/php_schema.c:2459
#3  0x0000000000a28714 in zend_hash_destroy (ht=0x1b8da00) at
/usr/local/src/php-7.1.0RC4/Zend/zend_hash.c:1238
#4  0x00000000007f1a17 in delete_psdl_int (p=0x1be5340) at
/usr/local/src/php-7.1.0RC4/ext/soap/php_sdl.c:3130
#5  0x00000000007f1ad7 in delete_psdl (zv=0x1b8d430) at
/usr/local/src/php-7.1.0RC4/ext/soap/php_sdl.c:3150
#6  0x0000000000a287ea in zend_hash_destroy (ht=0x1b00000) at
/usr/local/src/php-7.1.0RC4/Zend/zend_hash.c:1257
#7  0x00000000007b3963 in zm_shutdown_soap (type=1, module_number=33) at
/usr/local/src/php-7.1.0RC4/ext/soap/soap.c:598
#8  0x0000000000a1dc9c in module_destructor (module=0x19866d0) at
/usr/local/src/php-7.1.0RC4/Zend/zend_API.c:2499
#9  0x0000000000a12021 in module_destructor_zval (zv=0x7ffd2f850270) at
/usr/local/src/php-7.1.0RC4/Zend/zend.c:632
#10 0x0000000000a27dfd in _zend_hash_del_el_ex (ht=0x1444dc0 <module_registry>, idx=32,
p=0x19ba5a0, prev=0x0) at /usr/local/src/php-7.1.0RC4/Zend/zend_hash.c:1000
#11 0x0000000000a27ec8 in _zend_hash_del_el (ht=0x1444dc0 <module_registry>, idx=32,
p=0x19ba5a0) at /usr/local/src/php-7.1.0RC4/Zend/zend_hash.c:1023
#12 0x0000000000a291b5 in zend_hash_graceful_reverse_destroy (ht=0x1444dc0 <module_registry>)
at /usr/local/src/php-7.1.0RC4/Zend/zend_hash.c:1479
#13 0x0000000000a1bc57 in zend_destroy_modules () at
/usr/local/src/php-7.1.0RC4/Zend/zend_API.c:1978
#14 0x0000000000a1268d in zend_shutdown () at /usr/local/src/php-7.1.0RC4/Zend/zend.c:860
#15 0x0000000000984084 in php_module_shutdown () at /usr/local/src/php-7.1.0RC4/main/main.c:2401
#16 0x0000000000af4610 in main (argc=4, argv=0x197cb30) at
/usr/local/src/php-7.1.0RC4/sapi/cli/php_cli.c:1393

------------------------------------------------------------------------
[2016-10-04 23:49:03] dominic at varspool dot com

Sorry, more symbols:

#0  zend_hash_destroy (ht=0x55555656c0f0) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_hash.c:1278
#1  0x00007fffe7e81f51 in delete_type_persistent (zv=<optimized out>) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/ext/soap/php_schema.c:2459
#2  0x00005555557b9ead in zend_hash_destroy (ht=0x5555563500f0) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_hash.c:1265
#3  0x00007fffe7e89401 in delete_psdl_int (p=<optimized out>) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/ext/soap/php_sdl.c:3130
#4  0x00007fffe7e8946f in delete_psdl (zv=0x555556627c60) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/ext/soap/php_sdl.c:3150
#5  0x00005555557b9da2 in zend_hash_destroy (ht=0x555556351320) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_hash.c:1276
#6  0x00007fffe7e59f0b in zm_shutdown_soap (type=<optimized out>, module_number=41) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/ext/soap/soap.c:598
#7  0x00005555557affa3 in module_destructor (module=module@entry=0x555555c27430) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_API.c:2505
#8  0x00005555557a8a4c in module_destructor_zval (zv=<optimized out>) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend.c:615
#9  0x00005555557ba918 in _zend_hash_del_el_ex (prev=<optimized out>, p=<optimized out>,
idx=<optimized out>, ht=<optimized out>) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_hash.c:1026
#10 _zend_hash_del_el (p=0x555555c1c550, idx=40, ht=0x555555b87860 <module_registry>) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_hash.c:1050
#11 zend_hash_graceful_reverse_destroy (ht=ht@entry=0x555555b87860 <module_registry>) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_hash.c:1502
#12 0x00005555557ae39c in zend_destroy_modules () at
/build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend_API.c:1984
#13 0x00005555557a9a15 in zend_shutdown () at /build/php7.0-j_qgKJ/php7.0-7.0.11/Zend/zend.c:840
#14 0x000055555574d20b in php_module_shutdown () at
/build/php7.0-j_qgKJ/php7.0-7.0.11/main/main.c:2362
#15 0x000055555563cb36 in main (argc=7, argv=0x555555b8ad20) at
/build/php7.0-j_qgKJ/php7.0-7.0.11/sapi/cli/php_cli.c:1359

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=71931


--
Edit this bug report at https://bugs.php.net/bug.php?id=71931&edit=1


Thread (15 messages)

« previous php.bugs (#205160) next »