php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60471 Random "Invalid request (unexpected EOF)" using a router script
Submitted: 2011-12-08 15:01 UTC Modified: 2017-04-12 13:52 UTC
Votes:98
Avg. Score:3.6 ± 1.2
Reproduced:77 of 83 (92.8%)
Same Version:17 (22.1%)
Same OS:14 (18.2%)
From: lolautruche at gmail dot com Assigned: sammyk (profile)
Status: Closed Package: Built-in web server
PHP Version: 5.4.0RC2 OS: Mac OS X 10.7.2 (Lion)
Private report: No CVE-ID: None
 [2011-12-08 15:01 UTC] lolautruche at gmail dot com
Description:
------------
From time to time, built-in server with router script logs this kind of stuff :

[Thu Dec  8 13:39:29 2011] 127.0.0.1:50358 Invalid request (Unexpected EOF)

This happens quite randomly, whatever the script has a close tag or not, whatever 
it has a blank line after close tag or not.

Test script:
---------------
php -S localhost:8000 router.php

Actual result:
--------------
[Thu Dec  8 13:39:29 2011] 127.0.0.1:50358 Invalid request (Unexpected EOF)

Patches

removes-unexpected-eof-message-from-cli-server.patch (last revision 2012-02-25 15:13 UTC by michal dot pipa dot xsolve at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-08 16:24 UTC] lolautruche at gmail dot com
This issue seems to happen only with Google Chrome
 [2011-12-08 16:24 UTC] patrickallaert@php.net
I can confirm those messages.

It looks like it happens only with Chrome/Chromium.
Debugging at the TCP level shows that it comes from empty messages:

TCP messages corresponding to port 41767 that generated the error message:
[Thu Dec  8 16:48:33 2011] 127.0.0.1:41767 Invalid request (Unexpected EOF)
appears below, as captured by Wireshark.


No.     Time        Source                Destination           Protocol Length 
Info
   1214 196.678104  127.0.0.1             127.0.0.1             TCP      74     
41767 > http-alt [SYN] Seq=0 Win=32792 Len=0 MSS=16396 SACK_PERM=1 
TSval=209439162 TSecr=0 WS=128

Frame 1214: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
    Arrival Time: Dec  8, 2011 16:48:22.673873000 CET
    Epoch Time: 1323359302.673873000 seconds
    [Time delta from previous captured frame: 9.255505000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 196.678104000 seconds]
    Frame Number: 1214
    Frame Length: 74 bytes (592 bits)
    Capture Length: 74 bytes (592 bits)
    [Frame is marked: True]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:tcp]
    [Coloring Rule Name: TCP SYN/FIN]
    [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 
(127.0.0.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT 
(Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable 
Transport) (0x00)
    Total Length: 60
    Identification: 0x6b16 (27414)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (6)
    Header checksum: 0xd1a3 [correct]
        [Good: True]
        [Bad: False]
    Source: 127.0.0.1 (127.0.0.1)
    Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 41767 (41767), Dst Port: http-alt 
(8080), Seq: 0, Len: 0
    Source port: 41767 (41767)
    Destination port: http-alt (8080)
    [Stream index: 78]
    Sequence number: 0    (relative sequence number)
    Header length: 40 bytes
    Flags: 0x02 (SYN)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...0 .... = Acknowledgement: Not set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..1. = Syn: Set
            [Expert Info (Chat/Sequence): Connection establish request (SYN): 
server port http-alt]
                [Message: Connection establish request (SYN): server port http-
alt]
                [Severity level: Chat]
                [Group: Sequence]
        .... .... ...0 = Fin: Not set
    Window size value: 32792
    [Calculated window size: 32792]
    Checksum: 0xfe30 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    Options: (20 bytes)
        Maximum segment size: 16396 bytes
        TCP SACK Permitted Option: True
        Timestamps: TSval 209439162, TSecr 0
            Kind: Timestamp (8)
            Length: 10
            Timestamp value: 209439162
            Timestamp echo reply: 0
        No-Operation (NOP)
        Window scale: 7 (multiply by 128)
            Kind: Window Scale (3)
            Length: 3
            Shift count: 7
            [Multiplier: 128]

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 3c 6b 16 40 00 40 06 d1 a3 7f 00 00 01 7f 00   .<k.@.@.........
0020  00 01 a3 27 1f 90 b5 5d a2 ac 00 00 00 00 a0 02   ...'...]........
0030  80 18 fe 30 00 00 02 04 40 0c 04 02 08 0a 0c 7b   ...0....@......{
0040  c9 ba 00 00 00 00 01 03 03 07                     ..........

No.     Time        Source                Destination           Protocol Length 
Info
   1215 196.678120  127.0.0.1             127.0.0.1             TCP      74     
http-alt > 41767 [SYN, ACK] Seq=0 Ack=1 Win=32768 Len=0 MSS=16396 SACK_PERM=1 
TSval=209439162 TSecr=209439162 WS=128

Frame 1215: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
    Arrival Time: Dec  8, 2011 16:48:22.673889000 CET
    Epoch Time: 1323359302.673889000 seconds
    [Time delta from previous captured frame: 0.000016000 seconds]
    [Time delta from previous displayed frame: 0.000016000 seconds]
    [Time since reference or first frame: 196.678120000 seconds]
    Frame Number: 1215
    Frame Length: 74 bytes (592 bits)
    Capture Length: 74 bytes (592 bits)
    [Frame is marked: True]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:tcp]
    [Coloring Rule Name: TCP SYN/FIN]
    [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 
(127.0.0.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT 
(Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable 
Transport) (0x00)
    Total Length: 60
    Identification: 0x0000 (0)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (6)
    Header checksum: 0x3cba [correct]
        [Good: True]
        [Bad: False]
    Source: 127.0.0.1 (127.0.0.1)
    Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: http-alt (8080), Dst Port: 41767 
(41767), Seq: 0, Ack: 1, Len: 0
    Source port: http-alt (8080)
    Destination port: 41767 (41767)
    [Stream index: 78]
    Sequence number: 0    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 40 bytes
    Flags: 0x12 (SYN, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgement: Set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..1. = Syn: Set
            [Expert Info (Chat/Sequence): Connection establish acknowledge 
(SYN+ACK): server port http-alt]
                [Message: Connection establish acknowledge (SYN+ACK): server 
port http-alt]
                [Severity level: Chat]
                [Group: Sequence]
        .... .... ...0 = Fin: Not set
    Window size value: 32768
    [Calculated window size: 32768]
    Checksum: 0xfe30 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    Options: (20 bytes)
        Maximum segment size: 16396 bytes
        TCP SACK Permitted Option: True
        Timestamps: TSval 209439162, TSecr 209439162
            Kind: Timestamp (8)
            Length: 10
            Timestamp value: 209439162
            Timestamp echo reply: 209439162
        No-Operation (NOP)
        Window scale: 7 (multiply by 128)
            Kind: Window Scale (3)
            Length: 3
            Shift count: 7
            [Multiplier: 128]
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 1214]
        [The RTT to ACK the segment was: 0.000016000 seconds]

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 3c 00 00 40 00 40 06 3c ba 7f 00 00 01 7f 00   .<..@.@.<.......
0020  00 01 1f 90 a3 27 cd 57 43 e8 b5 5d a2 ad a0 12   .....'.WC..]....
0030  80 00 fe 30 00 00 02 04 40 0c 04 02 08 0a 0c 7b   ...0....@......{
0040  c9 ba 0c 7b c9 ba 01 03 03 07                     ...{......

No.     Time        Source                Destination           Protocol Length 
Info
   1216 196.678136  127.0.0.1             127.0.0.1             TCP      66     
41767 > http-alt [ACK] Seq=1 Ack=1 Win=32896 Len=0 TSval=209439162 
TSecr=209439162

Frame 1216: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
    Arrival Time: Dec  8, 2011 16:48:22.673905000 CET
    Epoch Time: 1323359302.673905000 seconds
    [Time delta from previous captured frame: 0.000016000 seconds]
    [Time delta from previous displayed frame: 0.000016000 seconds]
    [Time since reference or first frame: 196.678136000 seconds]
    Frame Number: 1216
    Frame Length: 66 bytes (528 bits)
    Capture Length: 66 bytes (528 bits)
    [Frame is marked: True]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:tcp]
    [Coloring Rule Name: TCP]
    [Coloring Rule String: tcp]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 
(127.0.0.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT 
(Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable 
Transport) (0x00)
    Total Length: 52
    Identification: 0x6b17 (27415)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (6)
    Header checksum: 0xd1aa [correct]
        [Good: True]
        [Bad: False]
    Source: 127.0.0.1 (127.0.0.1)
    Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 41767 (41767), Dst Port: http-alt 
(8080), Seq: 1, Ack: 1, Len: 0
    Source port: 41767 (41767)
    Destination port: http-alt (8080)
    [Stream index: 78]
    Sequence number: 1    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 32 bytes
    Flags: 0x10 (ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgement: Set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
    Window size value: 257
    [Calculated window size: 32896]
    [Window size scaling factor: 128]
    Checksum: 0xfe28 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    Options: (12 bytes)
        No-Operation (NOP)
        No-Operation (NOP)
        Timestamps: TSval 209439162, TSecr 209439162
            Kind: Timestamp (8)
            Length: 10
            Timestamp value: 209439162
            Timestamp echo reply: 209439162
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 1215]
        [The RTT to ACK the segment was: 0.000016000 seconds]

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 34 6b 17 40 00 40 06 d1 aa 7f 00 00 01 7f 00   .4k.@.@.........
0020  00 01 a3 27 1f 90 b5 5d a2 ad cd 57 43 e9 80 10   ...'...]...WC...
0030  01 01 fe 28 00 00 01 01 08 0a 0c 7b c9 ba 0c 7b   ...(.......{...{
0040  c9 ba                                             ..

No.     Time        Source                Destination           Protocol Length 
Info
   1589 207.299251  127.0.0.1             127.0.0.1             TCP      66     
41767 > http-alt [FIN, ACK] Seq=1 Ack=1 Win=32896 Len=0 TSval=209449783 
TSecr=209439162

Frame 1589: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
    Arrival Time: Dec  8, 2011 16:48:33.295020000 CET
    Epoch Time: 1323359313.295020000 seconds
    [Time delta from previous captured frame: 7.356718000 seconds]
    [Time delta from previous displayed frame: 10.621115000 seconds]
    [Time since reference or first frame: 207.299251000 seconds]
    Frame Number: 1589
    Frame Length: 66 bytes (528 bits)
    Capture Length: 66 bytes (528 bits)
    [Frame is marked: True]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:tcp]
    [Coloring Rule Name: TCP SYN/FIN]
    [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 
(127.0.0.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT 
(Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable 
Transport) (0x00)
    Total Length: 52
    Identification: 0x6b18 (27416)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (6)
    Header checksum: 0xd1a9 [correct]
        [Good: True]
        [Bad: False]
    Source: 127.0.0.1 (127.0.0.1)
    Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 41767 (41767), Dst Port: http-alt 
(8080), Seq: 1, Ack: 1, Len: 0
    Source port: 41767 (41767)
    Destination port: http-alt (8080)
    [Stream index: 78]
    Sequence number: 1    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 32 bytes
    Flags: 0x11 (FIN, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgement: Set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...1 = Fin: Set
            [Expert Info (Chat/Sequence): Connection finish (FIN)]
                [Message: Connection finish (FIN)]
                [Severity level: Chat]
                [Group: Sequence]
    Window size value: 257
    [Calculated window size: 32896]
    [Window size scaling factor: 128]
    Checksum: 0xfe28 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    Options: (12 bytes)
        No-Operation (NOP)
        No-Operation (NOP)
        Timestamps: TSval 209449783, TSecr 209439162
            Kind: Timestamp (8)
            Length: 10
            Timestamp value: 209449783
            Timestamp echo reply: 209439162

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 34 6b 18 40 00 40 06 d1 a9 7f 00 00 01 7f 00   .4k.@.@.........
0020  00 01 a3 27 1f 90 b5 5d a2 ad cd 57 43 e9 80 11   ...'...]...WC...
0030  01 01 fe 28 00 00 01 01 08 0a 0c 7b f3 37 0c 7b   ...(.......{.7.{
0040  c9 ba                                             ..

No.     Time        Source                Destination           Protocol Length 
Info
   1590 207.299310  127.0.0.1             127.0.0.1             TCP      66     
http-alt > 41767 [FIN, ACK] Seq=1 Ack=2 Win=32768 Len=0 TSval=209449783 
TSecr=209449783

Frame 1590: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
    Arrival Time: Dec  8, 2011 16:48:33.295079000 CET
    Epoch Time: 1323359313.295079000 seconds
    [Time delta from previous captured frame: 0.000059000 seconds]
    [Time delta from previous displayed frame: 0.000059000 seconds]
    [Time since reference or first frame: 207.299310000 seconds]
    Frame Number: 1590
    Frame Length: 66 bytes (528 bits)
    Capture Length: 66 bytes (528 bits)
    [Frame is marked: True]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:tcp]
    [Coloring Rule Name: TCP SYN/FIN]
    [Coloring Rule String: tcp.flags & 0x02 || tcp.flags.fin == 1]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 
(127.0.0.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT 
(Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable 
Transport) (0x00)
    Total Length: 52
    Identification: 0x8a53 (35411)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (6)
    Header checksum: 0xb26e [correct]
        [Good: True]
        [Bad: False]
    Source: 127.0.0.1 (127.0.0.1)
    Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: http-alt (8080), Dst Port: 41767 
(41767), Seq: 1, Ack: 2, Len: 0
    Source port: http-alt (8080)
    Destination port: 41767 (41767)
    [Stream index: 78]
    Sequence number: 1    (relative sequence number)
    Acknowledgement number: 2    (relative ack number)
    Header length: 32 bytes
    Flags: 0x11 (FIN, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgement: Set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...1 = Fin: Set
            [Expert Info (Chat/Sequence): Connection finish (FIN)]
                [Message: Connection finish (FIN)]
                [Severity level: Chat]
                [Group: Sequence]
    Window size value: 256
    [Calculated window size: 32768]
    [Window size scaling factor: 128]
    Checksum: 0xfe28 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    Options: (12 bytes)
        No-Operation (NOP)
        No-Operation (NOP)
        Timestamps: TSval 209449783, TSecr 209449783
            Kind: Timestamp (8)
            Length: 10
            Timestamp value: 209449783
            Timestamp echo reply: 209449783
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 1589]
        [The RTT to ACK the segment was: 0.000059000 seconds]

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 34 8a 53 40 00 40 06 b2 6e 7f 00 00 01 7f 00   .4.S@.@..n......
0020  00 01 1f 90 a3 27 cd 57 43 e9 b5 5d a2 ae 80 11   .....'.WC..]....
0030  01 00 fe 28 00 00 01 01 08 0a 0c 7b f3 37 0c 7b   ...(.......{.7.{
0040  f3 37                                             .7

No.     Time        Source                Destination           Protocol Length 
Info
   1591 207.299319  127.0.0.1             127.0.0.1             TCP      66     
41767 > http-alt [ACK] Seq=2 Ack=2 Win=32896 Len=0 TSval=209449783 
TSecr=209449783

Frame 1591: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
    Arrival Time: Dec  8, 2011 16:48:33.295088000 CET
    Epoch Time: 1323359313.295088000 seconds
    [Time delta from previous captured frame: 0.000009000 seconds]
    [Time delta from previous displayed frame: 0.000009000 seconds]
    [Time since reference or first frame: 207.299319000 seconds]
    Frame Number: 1591
    Frame Length: 66 bytes (528 bits)
    Capture Length: 66 bytes (528 bits)
    [Frame is marked: True]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:tcp]
    [Coloring Rule Name: TCP]
    [Coloring Rule String: tcp]
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
    Destination: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Source: 00:00:00_00:00:00 (00:00:00:00:00:00)
        Address: 00:00:00_00:00:00 (00:00:00:00:00:00)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory 
default)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 
(127.0.0.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT 
(Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable 
Transport) (0x00)
    Total Length: 52
    Identification: 0x6b19 (27417)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (6)
    Header checksum: 0xd1a8 [correct]
        [Good: True]
        [Bad: False]
    Source: 127.0.0.1 (127.0.0.1)
    Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 41767 (41767), Dst Port: http-alt 
(8080), Seq: 2, Ack: 2, Len: 0
    Source port: 41767 (41767)
    Destination port: http-alt (8080)
    [Stream index: 78]
    Sequence number: 2    (relative sequence number)
    Acknowledgement number: 2    (relative ack number)
    Header length: 32 bytes
    Flags: 0x10 (ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgement: Set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
    Window size value: 257
    [Calculated window size: 32896]
    [Window size scaling factor: 128]
    Checksum: 0xfe28 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    Options: (12 bytes)
        No-Operation (NOP)
        No-Operation (NOP)
        Timestamps: TSval 209449783, TSecr 209449783
            Kind: Timestamp (8)
            Length: 10
            Timestamp value: 209449783
            Timestamp echo reply: 209449783
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 1590]
        [The RTT to ACK the segment was: 0.000009000 seconds]

0000  00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00   ..............E.
0010  00 34 6b 19 40 00 40 06 d1 a8 7f 00 00 01 7f 00   .4k.@.@.........
0020  00 01 a3 27 1f 90 b5 5d a2 ae cd 57 43 ea 80 10   ...'...]...WC...
0030  01 01 fe 28 00 00 01 01 08 0a 0c 7b f3 37 0c 7b   ...(.......{.7.{
0040  f3 37                                             .7
 [2011-12-09 05:44 UTC] laruence@php.net
I can't reproduce this on Linux. 

@patrickallaert, what is your OS?
 [2011-12-09 05:44 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2011-12-09 13:59 UTC] patrickallaert@php.net
@laruence:
Gentoo Linux

Most of the time, several of those messages appears in one block like in:

[Thu Dec  8 13:39:29 2011] 127.0.0.1:50358 Invalid request (Unexpected EOF)
[Thu Dec  8 13:39:29 2011] 127.0.0.1:50359 Invalid request (Unexpected EOF)
[Thu Dec  8 13:39:29 2011] 127.0.0.1:50360 Invalid request (Unexpected EOF)
[Thu Dec  8 13:39:29 2011] 127.0.0.1:50361 Invalid request (Unexpected EOF)
[Thu Dec  8 13:39:29 2011] 127.0.0.1:50362 Invalid request (Unexpected EOF)

I expect it comes from the fact that the page generated by the built-in server 
contains references to pictures, js and css files that has been downloaded by 
chrome through the built-in server. Does chrome do some special treatment? Can't 
reproduce with a dummy page with just an Hello World.
 [2012-02-12 17:06 UTC] rbrunius at gmail dot com
I'm am having the same thing happen and I Googled error code it and found this 
thread. I tried various ways to terminate the file but none solved it.

php 5.4 RC7 

development server on Windows 7

Chrome browser has brings the issue but Firefox does not.
 [2012-02-16 18:24 UTC] rasmus@php.net
Could this simply be caused by the "Connection: closed" message instead of the 
correct "Connection: close" message the built-in server spits out? This is fixed 
in trunk but hasn't been merged to 5.4 yet.
 [2012-02-16 18:29 UTC] rasmus@php.net
The patch is here:

http://svn.php.net/viewvc/php/php-src/trunk/sapi/cli/php_cli_server.c?
r1=323078&r2=323077&pathrev=323078&view=patch

if someone could test it, please.
 [2012-02-23 18:45 UTC] michal dot pipa dot xsolve at gmail dot com
I've noticed these messages and did some network traffic analysis.

I've tested this on Ubuntu and Chromium. What I've found is that Chromium has feature called "Predict network actions to improve page load performance" and it's enabled by default. It works this way, that if HTML page has links to some resources, than Chromium opens about 10 TCP connections in advance. And then if browser has less than 10 resources to fetch, unused connections times out after 10 seconds. And this (empty payload) causes PHP server to display "Invalid request (unexpected EOF)" message.

See: http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c?revision=322966&view=markup#l1591

When you disable this Chromium's feature it doesn't open TCP connections in advance and this error message disappears.

I'm wondering if we really need this error message (maybe it was used for some debugging purposes).
 [2012-02-25 15:15 UTC] michal dot pipa dot xsolve at gmail dot com
I've attached a patch that disables "Unexpected EOF" error message from built-in server.
 [2012-10-24 07:36 UTC] pascal dot chevrel at free dot fr
Just in case it matters, I am seeing the same bug on Linux with Firefox (both Firefox releases and Nightly builds)
 [2012-10-24 07:39 UTC] laruence@php.net
Hey, actually, this warnnig message is no harm.
 [2014-05-13 12:34 UTC] madara at tchizik dot com
Same in PHP 5.5.9-1ubuntu4. I get those occasionally too when viewing from Chrome.
 [2014-05-13 15:20 UTC] mike@php.net
This just happens when a keep-alive connection closes...
 [2014-09-28 16:20 UTC] write2reuben at gmail dot com
Get this message after requesting a valid php file....

C:\mystuff\php-5.6.0\myphp>..\php -S 127.0.0.1:60024 -t .
PHP 5.6.1 Development Server started at Sun Sep 28 12:14:34 2014
Listening on http://127.0.0.1:60024
Document root is C:\mystuff\php-5.6.0\myphp
Press Ctrl-C to quit.
[Sun Sep 28 12:14:44 2014] 127.0.0.1:57374 [404]: / - No such file or directory
[Sun Sep 28 12:14:50 2014] 127.0.0.1:57375 Invalid request (Unexpected EOF)
[Sun Sep 28 12:14:57 2014] 127.0.0.1:57378 [200]: /php1.php
[Sun Sep 28 12:15:03 2014] 127.0.0.1:57379 Invalid request (Unexpected EOF)
[Sun Sep 28 12:15:14 2014] 127.0.0.1:57382 [200]: /php1.php
[Sun Sep 28 12:15:20 2014] 127.0.0.1:57383 Invalid request (Unexpected EOF)
 [2015-06-02 09:13 UTC] stephane at winnepenninckx dot com
Mac OS X 10.10.3 and PHP 5.6.5, this bug does no harm but I lost some time.
 [2015-11-24 22:34 UTC] alex311es at gmail dot com
Same error

Mac 10.10.5

PHP 5.6.15 (cli) (built: Oct 31 2015 07:39:24)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans
 [2016-05-13 20:41 UTC] tomer dot leader at gmail dot com
Same issue at PHP 5.5.12 Development Server on windows.
 [2016-08-04 09:28 UTC] victor at tuxayo dot net
I think I've got the same issue with php 7.0.9

Using the PhantomJS 2.1 browser (which uses webkit) for automated tests.

I have a test that logs in my app and goes to the main page.

When running the test in loop, in less than 50 runs (usually 15) the test freezes. PhantomJS is waiting for a response from the server which never comes.
And the logs always show an Invalid request (Unexpected EOF) at that moment.


[theDate] theIP:50492 [200]: /resources/
[theDate] theIP:50496 [200]: /resources/css/style.css
[theDate] theIP:50498 [200]: /resources/css/thickbox.css
[theDate] theIP:50500 [200]: /resources/css/datePicker.css
[theDate] theIP:50502 [200]: /resources/css/jquery.autocomplete.css
[theDate] theIP:50504 [200]: /resources/css/jquery.tooltip.css
[theDate] theIP:50716 [200]: /resources/js/plugins/jquery.js
[theDate] theIP:50712 [200]: /resources/js/plugins/ajaxupload.3.5.js
[theDate] theIP:50706 Invalid request (Unexpected EOF)
[theDate] theIP:50710 [200]: /resources/js/plugins/jquery.autocomplete.js
[theDate] theIP:50714 [200]: /resources/js/plugins/Gettext.js
[theDate] theIP:50708 [200]: /resources/js/plugins/translate.js
[theDate] theIP:50722 [200]: /resources/js/index.js
[theDate] theIP:50718 [200]: /resources/js/plugins/date.js
[theDate] theIP:50720 [200]: /resources/js/plugins/jquery.datePicker.js
[theDate] theIP:50724 [200]: /resources/js/common.js
 [2016-08-04 09:44 UTC] victor at tuxayo dot net
I was able to also reproduce with PHP 5.6.24
 [2016-08-16 14:31 UTC] victor at tuxayo dot net
@mike

I think I managed to disable the keep alive in PhantomJS (by adding "Connection": "close" in the headers of each request) and can still reproduce the issue.

@laruence

If this issue is only a warning, would this mean it's unrelated to my issue with my browser (PhantomJS) waiting infinitely a response from the server? Which doesn't happen with Apache.
 [2016-08-20 16:19 UTC] admin at codeanimu dot net
I've had the occur quite often when testing using PhantomJS as well. Completely freezes the tests which is annoying.
Had it occur both locally on Windows & remotely on Linux. Both running PHP7.
Strangely it only seems to occur when loading in CSS/JS libraries.
 [2016-08-23 12:58 UTC] yonelceruto at gmail dot com
I've the same problem in php 7.0.8 apache 2.4.18 Google Chrome / FF
 [2016-09-01 21:18 UTC] victor at tuxayo dot net
@codeanimu

How where you able to tell which request is related to the freeze? Even with the server logs and Wireshark, I wasn't able to find out.
 [2016-09-01 21:37 UTC] admin at codeanimu dot net
@victor : I wasn't really able to tell exactly, but after a fair amount of testing on pages with many requests it only ever seemed to fail when loading them, images always seemed to load fine. Might have just been luck though.

I should probably mention that the issue we're having is probably just a PhantomJS problem, and not PHP.
Found these after posting the previous comment: https://github.com/ariya/phantomjs/issues/14286 / https://github.com/ariya/phantomjs/issues/10652
 [2016-09-10 09:50 UTC] falcon560 at gmail dot com
The issue remains unresolved using PHP Version 7.0.6. and fedora version 24. It looks like its not a page related issue as not requests are generated in firefox/firebug console (using firefox 48). Yet the message keeps on coming whenever i switch to a page that has been served by the CLI server after that the message continues every second or so until i switch to some other page.

[Sat Sep 10 14:48:00 2016] 127.0.0.1:46510 Invalid request (Unexpected EOF)
 [2016-09-11 19:55 UTC] victor at tuxayo dot net
@codeanimu Oh good find! That would mean that the freeze issue is just the PhantomJS bug that is exacerbated but the PHP built-in server? And that it just triggers the "Invalid request (unexpected EOF)" as a side effect.
 [2016-10-14 02:09 UTC] brcontainer at yahoo dot com dot br
It happens without router too.
 [2017-04-12 13:52 UTC] sammyk@php.net
-Status: Assigned +Status: Closed -Assigned To: laruence +Assigned To: sammyk
 [2017-04-12 13:52 UTC] sammyk@php.net
This has been fixed in PHP 7.2 via https://github.com/php/php-src/pull/2442.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC