From:             [EMAIL PROTECTED]
Operating system: N/A
PHP version:      4.3.7
PHP Bug Type:     Sockets related
Bug description:  fread "gready" behaviour

Description:
------------
When grabbing code with fread it exhibits "gready" behaviour. i.e. It does
not ignore packet boundaries.

We expect to get 6 packets when using fread 6 times. PHP currently joins
the packets together into 3 packets. I assume it keeps those packets
seperate because they have different source ips.

Reproduce code:
---------------
Tests run with: http://nopaste.php.cd/20417

Expected result:
----------------
With modified source, the expected result:

recv(3, "\377\377\377\377j\0", 8192, 0) = 6
recv(3, "\377\377\377\377j\0", 8192, 0) = 6
recv(7, "\377\377\377\377j\0", 8192, 0) = 6
recv(7, "\377\377\377\377j\0", 8192, 0) = 6
recv(8, "\377\377\377\377j\0", 8192, 0) = 6
recv(8, "\377\377\377\377j\0", 8192, 0) = 6
1 6
2 6
3 6
4 6
5 6
6 6

Actual result:
--------------
Strace:
recv(4, "\377\377\377\377j\0", 8192, 0) = 6
recv(4, "\377\377\377\377j\0", 8192, 0) = 6
recv(4, 0x82d3bfc, 8192, 0)             = -1 EAGAIN (Resource temporarily
unavailable)
recv(8, "\377\377\377\377j\0", 8192, 0) = 6
recv(8, "\377\377\377\377j\0", 8192, 0) = 6
recv(8, 0x82dc984, 8192, 0)             = -1 EAGAIN (Resource temporarily
unavailable)
recv(9, "\377\377\377\377j\0", 8192, 0) = 6
recv(9, "\377\377\377\377j\0", 8192, 0) = 6
recv(9, 0x82de994, 8192, 0)             = -1 EAGAIN (Resource temporarily
unavailable)

PHP Script output: (packet + size)
1 12
2 12
3 12


-- 
Edit bug report at http://bugs.php.net/?id=28964&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28964&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28964&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28964&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28964&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28964&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28964&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28964&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28964&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28964&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28964&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28964&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28964&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28964&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28964&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28964&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28964&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28964&r=float

Reply via email to