Some preliminary information:
- Browser - Firefox 104.0 (64-bit)
- Server - Custom code. My server allows up to 18 sockets, 6 of which can be HTTP connections.
I have one last issue with my server implementation that I just cannot figure out. If the request is for a somewhat small file, usually the transfer happens without issue. When requesting larger files, the file transfer stalls.
My test case that works: Open a tab and enter http://SA-8.lan/favicon.ico. Hold shift and click on refresh. All works ok. favicon.ico is 489 bytes.
My test case that fails: Open a tab and enter http://sa-8.lan/js/math.min.js. Hold shift and click on refresh. Fails. math.min.js is 451.4 kB
This issue is that when the page is refreshed on the large file transfer, Firefox initiates a second HTTP request during the transfer of math.min.js. This should not present a problem as my server opens another socket (because the port number is different) and handles the 2nd request. What's odd is that when the next packet of the first socket is sent, the browser does not ACK it.
The sequence and ack numbers all look fine. Wireshark recognizes it as a TCP segment of a reassembled PDU. For some reason that I cannot understand, the browser does not ACK and, after a long delay, sends a TCP Keep-Alive with the Sequence # minus 1.
Why does the browser not respond to my packet segment?
(Apparently I cannot attach the wireshark pcap until I have >60 something, so I'll put the pertinent packet bytes here)
No. Time Source Destination Protocol Length Info
1 0.000000000 10.0.0.188 10.0.0.225 TCP 74 43070 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=1270624431 TSecr=0 WS=128
2 0.001635595 10.0.0.225 10.0.0.188 TCP 66 80 → 43070 [SYN, ACK] Seq=0 Ack=1 Win=1460 Len=0 MSS=1460 SACK_PERM=1 WS=128
3 0.001674970 10.0.0.188 10.0.0.225 TCP 54 43070 → 80 [ACK] Seq=1 Ack=1 Win=64256 Len=0
4 0.001751029 10.0.0.188 10.0.0.225 HTTP 451 GET /js/math.min.js HTTP/1.1
5 0.004238756 10.0.0.225 10.0.0.188 TCP 60 80 → 43070 [ACK] Seq=1 Ack=398 Win=186880 Len=0
6 0.024392047 10.0.0.225 10.0.0.188 TCP 1514 80 → 43070 [ACK] Seq=1 Ack=398 Win=186880 Len=1460 [TCP segment of a reassembled PDU]
7 0.024405659 10.0.0.188 10.0.0.225 TCP 54 43070 → 80 [ACK] Seq=398 Ack=1461 Win=64128 Len=0
8 0.038481649 10.0.0.225 10.0.0.188 TCP 1514 80 → 43070 [ACK] Seq=1461 Ack=398 Win=186880 Len=1460 [TCP segment of a reassembled PDU]
9 0.038494319 10.0.0.188 10.0.0.225 TCP 54 43070 → 80 [ACK] Seq=398 Ack=2921 Win=64128 Len=0
10 0.052616814 10.0.0.225 10.0.0.188 TCP 1514 80 → 43070 [ACK] Seq=2921 Ack=398 Win=186880 Len=1460 [TCP segment of a reassembled PDU]
11 0.052638389 10.0.0.188 10.0.0.225 TCP 54 43070 → 80 [ACK] Seq=398 Ack=4381 Win=64128 Len=0
.... (skipped some packets for brevity) ....
No. Time Source Destination Protocol Length Info
72 1.220794991 10.0.0.225 10.0.0.188 TCP 1514 80 → 43070 [ACK] Seq=48181 Ack=398 Win=186880 Len=1460 [TCP segment of a reassembled PDU]
73 1.266740106 10.0.0.188 10.0.0.225 TCP 54 43070 → 80 [ACK] Seq=398 Ack=49641 Win=64128 Len=0
74 1.280819523 10.0.0.225 10.0.0.188 TCP 1514 80 → 43070 [ACK] Seq=49641 Ack=398 Win=186880 Len=1460 [TCP segment of a reassembled PDU]
75 1.301652905 10.0.0.188 10.0.0.225 TCP 74 43074 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=1270625733 TSecr=0 WS=128
76 1.303284866 10.0.0.225 10.0.0.188 TCP 66 80 → 43074 [SYN, ACK] Seq=0 Ack=1 Win=1460 Len=0 MSS=1460 SACK_PERM=1 WS=128
77 1.303316377 10.0.0.188 10.0.0.225 TCP 54 43074 → 80 [ACK] Seq=1 Ack=1 Win=64256 Len=0
78 1.303445281 10.0.0.188 10.0.0.225 HTTP 399 GET /favicon.ico HTTP/1.1
79 1.305447545 10.0.0.225 10.0.0.188 TCP 150 80 → 43074 [ACK] Seq=1 Ack=1 Win=186880 Len=96 [TCP segment of a reassembled PDU]
80 1.305467257 10.0.0.188 10.0.0.225 TCP 54 43074 → 80 [ACK] Seq=346 Ack=97 Win=64256 Len=0
81 1.306119233 10.0.0.225 10.0.0.188 HTTP 60 HTTP/1.1 503 Service Unavailable
82 1.306246772 10.0.0.188 10.0.0.225 TCP 54 43074 → 80 [FIN, ACK] Seq=346 Ack=98 Win=64256 Len=0
83 1.307186083 10.0.0.225 10.0.0.188 TCP 60 80 → 43074 [ACK] Seq=98 Ack=347 Win=186880 Len=0
84 1.322753934 10.0.0.188 10.0.0.225 TCP 54 43070 → 80 [ACK] Seq=398 Ack=51101 Win=64128 Len=0
85 1.336850281 10.0.0.225 10.0.0.188 TCP 1514 80 → 43070 [ACK] Seq=51101 Ack=398 Win=186880 Len=1460 [TCP segment of a reassembled PDU]
86 11.290742683 10.0.0.188 10.0.0.225 TCP 54 [TCP Keep-Alive] 43070 → 80 [ACK] Seq=397 Ack=51101 Win=64128 Len=0
Any suggestions would be appreciated. I've tried changing server HTTP reply to Connection: Keep-Alive. I will probably have to resort to a lazy load, although I don't want to. Most odd thing: this only happens when connected to certain routers (LAN port to LAN port) - Kasda exhibits the behaviour, Netgear does not.
P.S. Is there a way to debug the browser to see why is didn't ACK?