|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-09-25 07:18 UTC] Slig at free dot fr
[2008-07-14 21:23 UTC] jani@php.net
[2008-07-22 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 18:00:01 2025 UTC |
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