#32861 [Bgs]: timeout is ignored in stream_select function

From: Date: Thu, 26 May 2005 22:04:55 +0000
Subject: #32861 [Bgs]: timeout is ignored in stream_select function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-79577@lists.php.net to get a copy of this message
ID: 32861 User updated by: lew at mailduct dot com Reported By: lew at mailduct dot com Status: Bogus Bug Type: Filesystem function related Operating System: FreeBSD 4.11-REL PHP Version: 4.3.10 New Comment: I have now tested this using both PHP 4.3.11 and 5.0.4, and the bug remains. My same prior notes apply. Please review. Previous Comments: ------------------------------------------------------------------------ [2005-04-28 07:45:59] lew at mailduct dot com I believe that under the OS and PHP version given in the headers of this report, the stream timeout function is not working when used with fgets as well. However, I will load the current PHP on the box and test again, to ensure I provide you with accurate and complete information and I'll open a new pr if necessary. Let's close this one as Bogus. ------------------------------------------------------------------------ [2005-04-28 00:35:16] pollita@php.net From the stream_select() manual page: The streams listed in the read array will be watched to see if characters become available for reading (more precisely, to see if a read will not block - in particular, a stream resource is also ready on end-of-file, in which case an fread() will return a zero length string). ------------------------------------------------------------------------ [2005-04-28 00:05:08] sniper@php.net Does this happen with PHP 4.3.11 or 5.0.4 ? ------------------------------------------------------------------------ [2005-04-27 21:53:44] lew at mailduct dot com Description: ------------ Timeouts are ignored in stream_select. Instead, it always returns with "1" as the number of streams affected, ignoring any timeout seconds that are set. This is true regardless of stream_set_blocking settings. This may or may not be related to my reported FEOF problems: pr #25649 (Sep 2003) pr #32858 (Apr 2005) Reproduce code: --------------- $fp = fopen( '/var/log/maillog','r' ); ## Tried both ways, got same results #stream_set_blocking( $fp,TRUE ); #stream_set_blocking( $fp,FALSE ); $r = array( $fp ); while( TRUE ) { $n = stream_select( $r,$w=NULL,$e=NULL,30 ); if( $n===FALSE ) echo "stream_select = FALSE\n"; else echo "stream_select = $n\n"; echo fgets($fp); print( '.' ); } Expected result: ---------------- Assuming no other program is writing to /var/log/maillog, I expect to see a timeout condition every 30 seconds, as such: stream_select = FALSE Actual result: -------------- Instead, I see iterations of: stream_select = 1 as fast as the system can execute the loop. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32861&edit=1

« previous php.bugs (#79577) next »