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: 2014-08-07 16:59 UTC
Votes:96
Avg. Score:4.9 ± 0.4
Reproduced:86 of 86 (100.0%)
Same Version:24 (27.9%)
Same OS:61 (70.9%)
From: valer_crisan at yahoo dot com Assigned: rdlowrey (profile)
Status: Closed Package: SOAP related
PHP Version: 5.2 - 5.6 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: valer_crisan at yahoo dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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?
 [2014-08-06 14:29 UTC] m dot staab at complex-it dot de
It feels like I experience this problem on

Ubuntu 12.04.4 LTS
PHP 5.4.30-1+deb.sury.org~precise+1
 [2014-08-07 16:59 UTC] rdlowrey@php.net
-Status: Open +Status: Closed -Operating System: Linux +Operating System: * -PHP Version: 5.2.9 +PHP Version: 5.2 - 5.6 -Assigned To: +Assigned To: rdlowrey
 [2014-08-07 16:59 UTC] rdlowrey@php.net
This issue has been addressed by the resolution to Bug #41631 (of which this report is a duplicate):

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

The fix has been applied to the 5.4, 5.5, 5.6 and master branches and will appear in the following forthcoming releases:

- 5.4.33
- 5.5.17
- 5.6.0-rc4
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 10:01:28 2024 UTC