#45016 [Opn]: connect timeout on successful connect
| From: | kalle@php.net | Date: | Tue, 08 Jul 2008 01:39:55 +0000 |
| Subject: | #45016 [Opn]: connect timeout on successful connect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126358@lists.php.net to get a copy of this message | ||
ID: 45016
Updated by: kalle@php.net
Reported By: tpowell at electric-cloud dot com
Status: Open
Bug Type: OpenSSL related
Operating System: all
PHP Version: 5.3CVS-2008-05-16 (CVS)
New Comment:
Try this patch:
http://phpfi.com/330065 (against latest PHP_5_3 cvs)
Previous Comments:
------------------------------------------------------------------------
[2008-05-16 00:12:40] tpowell at electric-cloud dot com
Description:
------------
On unusually slow ssl connects, we get a timeout message even through
the connect succeeded.
The offending code appears to be around line 816 of xp_ssl.c version
1.37 (the bug appears to have been around since 1.28)
struct timeval tvs, tve;
struct timezone tz;
gettimeofday(&tvs, &tz);
n = SSL_connect(sslsock->ssl_handle);
gettimeofday(&tve, &tz);
timeout -= (tve.tv_sec + tve.tv_usec /
1000000) - (tvs.tv_sec + tvs.tv_usec / 1000000);
if (timeout < 0) {
php_error_docref(NULL
TSRMLS_CC, E_WARNING, "SSL: connection timeout");
return -1;
}
The timeout is checked before the success value. A fix would be to
only check the timeout when deciding to loop again.
Reproduce code:
---------------
Peg the cpu of the test machine, attempt to make several ssl
connections out.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45016&edit=1