Bug #79497 [NEW]: stream_socket_client() throws an unknown error sometimes with <1s timeout
| From: | joey dot cai at gmail dot com | Date: | Mon, 20 Apr 2020 01:53:17 +0000 |
| Subject: | Bug #79497 [NEW]: stream_socket_client() throws an unknown error sometimes with <1s timeout | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-226674@lists.php.net to get a copy of this message | ||
From: joey dot cai at gmail dot com
Operating system:
PHP version: Irrelevant
Package: OpenSSL related
Bug Type: Bug
Bug description:stream_socket_client() throws an unknown error sometimes with <1s timeout
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 bug report at https://bugs.php.net/bug.php?id=79497&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79497&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79497&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79497&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79497&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79497&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79497&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79497&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79497&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79497&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79497&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79497&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79497&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79497&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79497&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79497&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79497&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79497&r=mysqlcfg