#42720 [NEW]: fread timeout with available datas

From: Date: Fri, 21 Sep 2007 00:02:00 +0000
Subject: #42720 [NEW]: fread timeout with available datas
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117733@lists.php.net to get a copy of this message
From: Slig at free dot fr Operating system: linux PHP version: 4CVS-2007-09-21 (snap) PHP Bug Type: Streams related Bug description: fread timeout with available datas Description: ------------ Seems to be on all 5.2, 6 snap, on 32 bits and 64 bits linux. Note the delay of the last read : it make a 60s timeout while it should not because datas are available to read. Reading data with a bigger length value or setting a small timeout time on the stream show that the data is available immediatly, this timeout shouyld not happen. It seems to happen only to the last read, when all readable datas where not read in one shot. Reproduce code: --------------- <?php $handle = fsockopen('tcp://smtp',25); //stream_set_timeout($handle,0,1); while(!feof($handle)) { $r = array($handle); $w = null; $e = array($handle); $nb = stream_select($r,$w,$e,3); echo "select : $nb, r=".count($r).', w='.count($w).', e='.count($e)."\n"; while($nb>0){ echo "Reading...\n"; $time = microtime(true); $contents = fread($handle,30); $delay = sprintf("%0.6f",(microtime(true)-$time)); echo "Contents(delay:$delay): [$contents]\n"; $r = array($handle); $w = null; $e = array($handle); $nb = stream_select($r,$w,$e,3); echo "select : $nb, r=".count($r).', w='.count($w).', e='.count($e)."\n"; } usleep(20000); } fclose($handle); ?> Expected result: ---------------- select : 1, r=1, w=0, e=0 Reading... Contents(delay:0.000124): [220 naxos2.unice.fr ESMTP Send] select : 1, r=1, w=0, e=1 Reading... Contents(delay:0.000011): [mail 8.13.1/8.13.1; Fri, 21 Se] select : 1, r=1, w=0, e=1 Reading... Contents(delay:0.000087): [p 2007 01:55:13 +0200 ] select : 0, r=0, w=0, e=0 select : 0, r=0, w=0, e=0 Actual result: -------------- select : 1, r=1, w=0, e=0 Reading... Contents(delay:0.000053): [220 naxos2.unice.fr ESMTP Send] select : 1, r=1, w=0, e=1 Reading... Contents(delay:0.000010): [mail 8.13.1/8.13.1; Fri, 21 Se] select : 1, r=1, w=0, e=1 Reading... Contents(delay:60.004428): [p 2007 01:53:18 +0200 ] select : 0, r=0, w=0, e=0 select : 0, r=0, w=0, e=0 -- Edit bug report at http://bugs.php.net/?id=42720&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42720&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42720&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42720&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42720&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42720&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42720&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42720&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42720&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42720&r=support Expected behavior: http://bugs.php.net/fix.php?id=42720&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42720&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42720&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42720&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42720&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42720&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42720&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42720&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42720&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42720&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42720&r=mysqlcfg

« previous php.bugs (#117733) next »