Bug #79497 [Opn->Csd]: stream_socket_client() throws an unknown error sometimes with <1s timeout
| From: | nikic@php.net | Date: | Mon, 20 Apr 2020 08:27:27 +0000 |
| Subject: | Bug #79497 [Opn->Csd]: stream_socket_client() throws an unknown error sometimes with <1s timeout | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226678@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79497&edit=1
ID: 79497
Updated by: nikic@php.net
Reported by: joey dot cai at gmail dot com
Summary: stream_socket_client() throws an unknown error
sometimes with <1s timeout
-Status: Open
+Status: Closed
Type: Bug
Package: OpenSSL related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of joe.cai@bigcommerce.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=94e09bfe558656d3f1470dc960b900a951b0dffc
Log: Fix #79497: Fix php_openssl_subtract_timeval()
Previous Comments:
------------------------------------------------------------------------
[2020-04-20 01:53:17] joey dot cai at gmail dot com
Description:
------------
stream_socket_client() can throw an unknown error when connection timeout is set to less than 1s due
to a bug in php_openssl_subtract_timeval()
A PR has been raised https://github.com/php/php-src/pull/5422
Test script:
---------------
https://gist.github.com/joec4i/ef1b1156ed79e23487400c68a5f693cb
// To test, run
php socket_test.php 10000 0.9 | grep error
Expected result:
----------------
No connection errors
Tested X connections(timeout=0.1) with in xs with 0 errors
Actual result:
--------------
failed in 0.0037751197814941s, error.no=0, errstr=
failed in 0.0031719207763672s, error.no=0, errstr=
failed in 0.0026381015777588s, error.no=0, errstr=
failed in 0.0029230117797852s, error.no=0, errstr=
failed in 0.0027728080749512s, error.no=0, errstr=
Tested 2000 connections(timeout=0.9) with in 6.1318738460541s with 5 errors
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79497&edit=1