php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41943 Soap Call causes CPU to go 100%
Submitted: 2007-07-09 19:39 UTC Modified: 2007-08-09 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: simon at connexon dot com Assigned: dmitry (profile)
Status: No Feedback Package: SOAP related
PHP Version: 5.2.3 OS: Windows Server 2003
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: simon at connexon dot com
New email:
PHP Version: OS:

 

 [2007-07-09 19:39 UTC] simon at connexon dot com
Description:
------------
We've been using soap for a while now and noticed that when we send a soap request and it waits for a response, PHP goes in a sort of loop and takes CPU load. Our average waiting time is 4 seconds.

A soap call once in a while is ok, because it doesn't take too much CPU overall. But we noticed that the more we grow, the more CPU it takes, to a point where we reach often 100% CPU if we do a loop of soap calls. (All that caused by the waiting time of the soap call!!!).

Reproduce code:
---------------
x

Expected result:
----------------
Would it be possible that PHP goes into an idle mode when it waits for a soap response instead of taking all the CPU ressources?

Actual result:
--------------
CPU goes crazy when we do too many soap calls in a row (we can do maximum of 4 soap calls at once, else it would overload the server).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-09 19:45 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2007-07-09 20:13 UTC] simon at connexon dot com
<?

$client = new SoapClient($wsdl_location, $params);

$date_time = date("Y-m-d H:i:s");		
			
$ws_params = array("valAddressMsg" => "aaa");		
					
$this->result = $this->handle->__soapCall("ValA", $ws_params);
			
if ($debug)	
	$this->displayMessageInfo();
			
$this->handleFault($this->result);

?>

When the code gets to "$this->handle->__soapCall..." we recognize the fact that when PHP is waiting for a soap response the CPU is blocked. However this is not a good behavior as of we need the CPU to do other things also.
 [2007-07-11 07:08 UTC] dmitry@php.net
Could you plese post strace of process or/and call-trace of PHP during it eats CPU.
 [2007-07-13 12:35 UTC] simon at connexon dot com
How do we do traces?

however I was able to isolate the problem. It's SSL that is causing CPU spikes. I ran a soap location with HTTP://, then the CPU would "idle" while it's waiting for a response, however using HTTPS:// the CPU really goes nuts!

Is this a problem in the core of PHP itself?
 [2007-07-25 06:25 UTC] dmitry@php.net
I am not able to reproduce this.

I created a simple client that accesses server over HTTPS:

<?php
  $client = new SoapClient(NULL,array(
    "location"=> "https://tpl/~dmitry/soap/examples/server4.php",
    "uri"     => "test://"));
  echo $client->getQuote("ibm");
?>

and server that sleeps for 15 seconds:
<?php
$quotes = array(
  "ibm" => 98.42
);  

function getQuote($symbol) {
  global $quotes;
  sleep(15);
  return $quotes[$symbol];
}

//ob_start("ob_gzhandler");
$server = new SoapServer("stockquote1.wsdl");
$server->addFunction("getQuote");
$server->handle();
?>

and I don't see any CPU load:
[dmitry@tpl CGI-DEBUG]$ time sapi/cli/php /home/dmitry/public_html/soap/examples/client8.php
98.42
real    0m15.105s
user    0m0.006s
sys     0m0.033s

I also run the same client on Windows looking into "perfmon" and CPU load was about 0% during waiting.

Please provide a COMPLETE reproducable case (client that access external SOAP server, or local client and srver), if you like me to fix the behavior.

 [2007-07-30 21:39 UTC] simon at connexon dot com
Hi dmitry, were you using apache or IIS under windows?

We are using IIS. Perhaps it is the source of the problem...

I will be doing more testing on this later this week. Please let me know.

Thank you.
 [2007-08-01 09:40 UTC] dmitry@php.net
On Windows I just called CLI PHP that accessed SOAP server on Linux/Apache.
 [2007-08-09 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".
 [2014-07-07 16:38 UTC] sblackstone at gmail dot com
I don't have an environment that I can provide a procedure to duplicate this issue, I'm seeing this same problem currently under php 5.3.28 connecting to an IIS server from an OSX dev box.

The SOAP server is a bit of a mess and can take up to 130 seconds to respond to queries - in the mean time the process pegs the CPU at 100% utilization. 

I tried to duplicate this setup with a dummy soap service on an ubuntu box, but I didn't see the same results..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 07:01:27 2024 UTC