|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-11-22 17:22 UTC] askalski at gmail dot com
Description: ------------ The PHP SOAP module leaks memory when it fails to parse a WSDL file. This leaked memory is not recovered between requests (mod_php). Test script: --------------- Download the following file into your script directory before testing: http://www.paypalobjects.com/wsdl/PayPalSvc.wsdl Do NOT download the dependent .xsd files (if they already exist in your directory, remove them.) The missing .xsd files will cause the WSDL parse failure which is essential to reproducing the memory leak. PHP should be configured as an Apache module (mod_php). <?php $s = new soapclient("PayPalSvc.wsdl"); ?> Request the script many times with curl or Apache Bench. Monitor memory/swap usage. (Be prepared to stop the test before it exhausts all of your memory. This will happen very quickly.) Expected result: ---------------- Apache worker memory usage should stay relatively constant. Actual result: -------------- Because of the leak, memory usage grows rapidly. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 14:00:01 2025 UTC |
I have the same issue on PHP 7.0.14. Have to notice, the problem connected not only with WSDL loading but with any SoapFault. Also, it is not only php_mod realted, can be reproduced in CLI. Looks like after SoapFault happens GC stops to work at all. Every single call of gc_collect_cycles() returns 0 instead of 1. Test: ---------------------------------------- <?php class MyClass { public $me; public function __construct() { $this->me = $this; } } $b = memory_get_usage(); try { $s = new SoapClient("dummy.wsdl"); } catch (\Exception $e) { echo $e->getMessage() . PHP_EOL; } for ($i = 0; $i < 3; $i++) { new MyClass(); echo gc_collect_cycles() . PHP_EOL; } var_dump(memory_get_usage() - $b); Expected result: ------------------------------------------ SOAP-ERROR: Parsing WSDL: Couldn't load from 'some.wsdl' : failed to load external entity "some.wsdl" int(0) Actual result: ------------------------------------------ SOAP-ERROR: Parsing WSDL: Couldn't load from 'some.wsdl' : failed to load external entity "some.wsdl" int(4168)