From: tpowell at electric-cloud dot com Operating system: all PHP version: 5.3CVS-2008-05-16 (CVS) PHP Bug Type: OpenSSL related Bug description: connect timeout on successful connect
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 bug report at http://bugs.php.net/?id=45016&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45016&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45016&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45016&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45016&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45016&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45016&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45016&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45016&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45016&r=support Expected behavior: http://bugs.php.net/fix.php?id=45016&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45016&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45016&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45016&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45016&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45016&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45016&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45016&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45016&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45016&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45016&r=mysqlcfg