#28964 [Opn->Csd]: fread "gready" behaviour
| From: | wez@php.net | Date: | Tue, 29 Jun 2004 21:52:20 +0000 |
| Subject: | #28964 [Opn->Csd]: fread "gready" behaviour | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61523@lists.php.net to get a copy of this message | ||
ID: 28964
Updated by: wez@php.net
Reported By: aidan@php.net
-Status: Open
+Status: Closed
Bug Type: Sockets related
Operating System: N/A
PHP Version: 4.3.7
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-06-29 23:49:30] aidan@php.net
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 this bug report at http://bugs.php.net/?id=28964&edit=1