ID:               42682
 User updated by:  Slig at free dot fr
-Summary:          stream_select indicate info readable when no more
 Reported By:      Slig at free dot fr
-Status:           Feedback
+Status:           Open
 Bug Type:         Streams related
 Operating System: linux-64
 PHP Version:      5CVS-2007-09-16 (snap)
 New Comment:

I tested today on a dual dual-core-xeon on current Fedora 7 x86_64,
first with current php and current openssl, then building php6 from the
source : same result, it give the expected result without openssl, but
return 0 when build with --with-openssl when there is a descriptor to
read.

Note: If i use as workaround 'while($nb>0 || count($r)>0){' and reduce
the read buffer ( fread($handle,30); for example), then i see that after
the first read the value returned by stream_select is ok... but it shows
another bug (#42720) :d


Previous Comments:
------------------------------------------------------------------------

[2007-09-19 08:26:27] Slig at free dot fr

OpenSSL on the tested computer: Architecture: amd64 , Version:
0.9.8c-4

I can try only on the same server with a different cpu (dual core xeon
and not quad core xeon) and another distro, but not sure when i'll have
time for that, i'll tell you the result here.

------------------------------------------------------------------------

[2007-09-18 09:40:37] [EMAIL PROTECTED]

I still can not reproduce this on my system.
OpenSSL Version => OpenSSL 0.9.8b 04 May 2006

Are you able to reproduce this on more than one machine? (and with
other linux distro than debian)

------------------------------------------------------------------------

[2007-09-16 20:27:23] Slig at free dot fr

Description:
------------
stream_select fails to return the number of modified descriptors.

The bug happen on linux amd64 (tested on a quad core xeon, debian etch
amd64) but not on x86 install (tested on a similar computer but dual
core xeon, debian etch x86).
It seems to happen only when php is built with openssl (i tried many
combinaisons), with php 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, php5 snap,
and also php6 snap.

This bug is the same as #40735 but I am unable to modify the status of
that bug.


I can eventually provide a ssh access to the computer further tests and
debug (ask me by email).

Reproduce code:
---------------
<?php
// replace with your smtp ip if needed, need a tcp server which reply
data immediatly
$handle = fsockopen('tcp://smtp',25);

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";
    $contents = fread($handle,8192);
    echo "Contents: [$contents]\n";

    $r = array($handle);
    $w = null;
    $e = array($handle);
    $nb = stream_select($r,$w,$e,1);
    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: [220 naxos2.unice.fr ESMTP Sendmail 8.13.1/8.13.1; Sun, 16
Sep 2007 22:23:04 +0200
]
select : 0, r=0, w=0, e=0


Actual result:
--------------
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0
select : 0, r=1, w=0, e=0



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42682&edit=1

Reply via email to