php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48524 Timeout setting is not considered on SOAP+HTTPS calls
Submitted: 2009-06-10 19:06 UTC Modified: 2009-09-09 11:03 UTC
Votes:89
Avg. Score:4.9 ± 0.4
Reproduced:80 of 80 (100.0%)
Same Version:24 (30.0%)
Same OS:58 (72.5%)
From: valer_crisan at yahoo dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.2.9 OS: Linux
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-06-10 19:06 UTC] valer_crisan at yahoo dot com
Description:
------------
The default_socket_timeout option is not taken in consideration when making SOAP requests to a HTTPS URL. 

This causes big issues for us because, if the server hung for some reason, the client waits forever to get a reply back.

The code works correctly when using HTTP URLs. But in our production environment we need to use HTTPS so this is not a workaround.

Reproduce code:
---------------
SOAP Server code:

$Server = new SoapServer('ed.wsdl');
$Server->setClass('Ed');
$Server->handle();
class Ed{
	public function hello($Input){
		sleep(30);
		return array('goodbye' => "Goodbye " . $Input->firstname);
	}
}

SOAP client code:

echo "Start time: " . date('c') . "\n";
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('default_socket_timeout', 5);
$Binding = new SoapClient('ed.wsdl', array('trace' => 1));
try {
  $Return = $Binding->hello(array('firstname' => 'john'));
  echo "Response: "; print_r($Return);
} catch( Exception $e ) {
  echo "Exception: "; print_r($e);
}
echo "End time: " . date('c') . "\n";

Let me know if you need the wsdl file as well.

Expected result:
----------------
I expect a SOAP timeout exception to be thrown.

Actual result:
--------------
The client gets the server response after 30 seconds, as shown here:

Start time: 2009-06-10T11:58:30-07:00
Response: stdClass Object
(
    [goodbye] => Goodbye john
)
End time: 2009-06-10T11:59:00-07:00


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-07 17:58 UTC] akomasinski at gmail dot com
I am seeing the same issue on PHP 5.3.0 on windows and linux.  The issue seems to be exactly as described.
 [2009-09-09 11:03 UTC] sjoerd@php.net
See also bug #41631
 [2009-09-14 10:00 UTC] maximchick at gmail dot com
Found the same behaviour: when connecting to SOAP server over http,
default_socket_timeout works as expected, but with HTTPS client hangs forever.

stream_context_create with timeout and connection_timeout options for SSL wrapper also not works.
 [2009-09-14 12:36 UTC] maximchick at gmail dot com
5.2.10 the bug still here
 [2009-12-11 13:00 UTC] arekm at maven dot pl
5.2.11 and 5.3.1, too.

example on maing ssl reads and writes timeoutable in python m2crypto

http://cvs.fedora.redhat.com/viewvc/F-12/m2crypto/m2crypto-0.18-timeouts.patch?revision=1.1&view=markup

which means that it is possible to do similar thing in php
 [2010-01-18 17:25 UTC] johnm04 at gmail dot com
I'm getting this issue on 5.2.0. 

WSDL retrieval works fine in various network timeout related tests Host pingable but no apache running, case where WSDL is a script with sleep(100000) and default_socket_timeout set both work.

However actual Soap endpoint (url provided in <service> section of WSDL - the script that does the work being provided) does not behave appropriately in various scenarios:

1. Server is pingable, but no apache service running.
   
   connection_timeout = 60
   default_socket_timeout = 60
   http / https both tested.
   I'd expect a soap exception or some sort of warning after 60 
   seconds or so, but the client just sits there indefinitely.


2. Server is pingable and Soap server script is present but just sleep(100000)'s
 
   connection_timeout = 60
   default_socket_timeout = 60
   http / https both tested.
   Again I'd expect an exception of some sort or a warning but the 
   client does not return in any reasonable length of time.



If there's a more appropriate bug report for this comment or if a new report is needed I'll stick it there.
 [2010-01-18 17:43 UTC] johnm04 at gmail dot com
To clarify my comment on [18 Jan 5:25pm UTC], timeouts for the WSDL portion of the process (as distinct from the actual SOAP part) only partially work.

When the WSDL is a script which only has a long sleep() in it, and is accessed over httpS, the connection does not timeout within a reasonable length of time.
 [2014-02-06 09:52 UTC] bhimraogadge at gmail dot com
I am facing the same issue. I have set 'default_socket_timeout' to 300 and expected the timeout should occur not more than 300 sec. But the soap call went for even 6400 seconds.

Is the issue is resolved in higher version? I am using version 5.3.

Is there any work around for this bug?
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 02:02:10 2014 UTC