Bug #69393 [Com]: fread() function on TLS stream timeout

From: Date: Fri, 17 Apr 2015 15:45:01 +0000
Subject: Bug #69393 [Com]: fread() function on TLS stream timeout
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192152@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69393&edit=1 ID: 69393 Comment by: shawn at digitalpoint dot com Reported by: contact at sshilko dot com Summary: fread() function on TLS stream timeout Status: Closed Type: Bug Package: Streams related Operating System: Linux PHP Version: 5.5.23 Assigned To: rdlowrey Block user comment: N Private report: N New Comment: Still broken in 5.6.8. Previous Comments: ------------------------------------------------------------------------ [2015-04-14 13:28:25] rdlowrey@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. For a long time (years) SSL streams didn't honor socket timeouts when reading. When this issue was finally addressed the fix broke stream_set_timeout() functionality on SSL streams. The default socket timeout is still observed in these releases (which is the reason for the 60 second timeout observed). Though this bug has been fixed upstream, it wasn't discovered until 5.5.23 and 5.6.7 were already in the RC stage and couldn't be included in these releases. The next set of bugfix releases resolves this issue. ------------------------------------------------------------------------ [2015-04-09 11:14:52] pk at maybe-phil dot net 5.6.7 is also affected. ------------------------------------------------------------------------ [2015-04-07 11:17:50] contact at sshilko dot com The actual time it takes for fread() is the stream_socket_client.timeout argument actually, even wehn the documentation says To set a timeout for reading/writing data over the socket, use the stream_set_timeout(), as the timeout only applies while making connecting the socket. in 5.5.23 this timeout is also used for fread() call. ------------------------------------------------------------------------ [2015-04-07 10:29:16] contact at sshilko dot com Description: ------------ The fread() call on TLS (SSL) stream times out after 60 seconds and does not honor the stream_set_timeout() values. 5.5.23 (tested) and probably 5.6.7 affected, 5.5.22 worked fine. Related git threads: https://github.com/duccio/ApnsPHP/issues/84 https://github.com/php/php-src/pull/971 Test script: --------------- https://gist.github.com/sshilko/41f04ddaaf5f73f0bb91 Expected result: ---------------- PHP 5.5.22-1+deb.sury.org~precise+1 (cli) (built: Feb 20 2015 11:25:27) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies Sending 172 bytes over tls://gateway.sandbox.push.apple.com:2195: Socket state: Array ( [stream_type] => tcp_socket/ssl [mode] => r+ [unread_bytes] => 0 [seekable] => [timed_out] => [blocked] => [eof] => ) Timeout set: 1 Has errors: string(0) "" real 0m0.261s user 0m0.040s sys 0m0.036s Actual result: -------------- PHP 5.5.23-1+deb.sury.org~precise+2 (cli) (built: Mar 24 2015 11:00:01) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies Sending 172 bytes over tls://gateway.sandbox.push.apple.com:2195: Socket state: Array ( [stream_type] => tcp_socket/ssl [mode] => r+ [unread_bytes] => 0 [seekable] => [timed_out] => [blocked] => [eof] => ) Timeout set: 1 Has errors: string(0) "" real 1m0.305s user 0m19.553s sys 0m39.170s ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69393&edit=1

« previous php.bugs (#192152) next »