TCP Flow Control: The Sliding Window, Zero Windows and Silly Window Syndrome
How TCP's advertised window keeps a fast sender from overrunning a slow receiver: the sliding window, what happens when a receiver stops reading and the window closes, persist probes and their backoff, and how both ends avoid silly window syndrome, measured in the lab.
kvi5hnuCode Sprout team member11 min readOn this page
TCP's receiver has a finite buffer. If the application reads slowly, data piles up there, and a sender that kept transmitting would just have its segments dropped. Flow control prevents this: every segment carries the receiver's window, the number of bytes it's currently willing to accept beyond what it has acknowledged. The sender never has more unacknowledged data in flight than the window allows. (Congestion control, article 72, adds a second limit for the network's sake. The sender obeys whichever is smaller.)
The sliding window
The sender's view of its byte stream has four regions:
- Bytes sent and acknowledged. They can be forgotten.
- Bytes sent but not yet acknowledged. They're kept for retransmission.
- Bytes not yet sent but allowed by the window. They can go out now.
- Bytes beyond the window. They must wait.
The window covers regions 2 and 3, starting at the oldest unacknowledged byte. As ACKs arrive, the left edge moves right (the window closes from the left). As the receiving application reads and frees buffer space, the receiver advertises a larger window, and the right edge moves right (the window opens). The right edge shouldn't move left: a receiver that shrinks the window, taking back space it had already offered, is discouraged by RFC 9293, although senders must cope with it.
The window field is 16 bits, scaled by the window scale option (article 60) on modern connections, so windows can be up to about 1 GB.
When the receiver stops reading
In the lab, a client set a small receive buffer and connected to a server that immediately started sending 2 MB. The client's application then didn't read anything for 8 seconds:
asked for 32768, SO_RCVBUF reports 65536
Linux doubles the requested SO_RCVBUF to leave room for its bookkeeping, so the buffer was 64 KB. Only part of that is offered as window, because Linux sets aside room for the memory overhead of each received packet. The share depends on packet sizes; on this connection it was roughly half, and the next article measures about two-thirds with full-sized segments. The window filled within a few round trips, and the client advertised a zero window: "I can't take anything more." The sender stopped. Then it started sending probes:
0.264 s client ACK 59369 window 0 (zero window)
0.291 s client ACK 59369 window 0
0.545 s server probe: seq 59368, no data (gap 0.28 s)
0.574 s client ACK 59369 window 0
1.067 s server probe: seq 59368, no data (gap 0.52 s)
1.096 s client ACK 59369 window 0
2.118 s server probe: seq 59368, no data (gap 1.05 s)
2.140 s client ACK 59369 window 0
4.103 s server probe: seq 59368, no data (gap 1.98 s)
4.134 s client ACK 59369 window 0
The chart below shows the whole 15-second run: the advertised window on top and the data sent below. The rest of this article explains each phase.

Persist probes
A zero window creates a deadlock risk. When the receiver frees space, it sends a window update, a pure ACK with a larger window. ACKs without data aren't acknowledged or retransmitted, so if that window update is lost, the receiver waits for data and the sender waits for a window, forever.
To prevent that, the sender runs a persist timer while the window is zero and sends a window probe each time it fires. The probe asks for a fresh ACK, which carries the current window. In the lab, Linux sent each probe as a segment with no data and a sequence number one below the next expected byte (seq 59,368 when the client expected 59,369), which the receiver can only answer with an ACK. (Other stacks send one byte of new data instead. Both work.)
The probes backed off exponentially, like retransmissions: about 0.28, 0.52, 1.05 and 1.98 seconds apart, starting from the RTO. Linux caps the interval at 120 seconds. While the stall lasted, ss showed the timer:
timer:(persist,113ms,0) rto:243 backoff:3 notsent:169416
client: done at 15.4 s
timer:(persist,...) is the time until the next probe, and backoff:3 the number of doublings. notsent is data the application has written that's waiting for window. Counters on both ends confirm the episode:
TcpExtTCPFromZeroWindowAdv 2 0.0
TcpExtTCPToZeroWindowAdv 2 0.0
TcpRetransSegs 2 0.0
TcpExtTCPWinProbe 8 0.0
TCPToZeroWindowAdv and TCPFromZeroWindowAdv count the receiver closing and reopening its window, and TCPWinProbe the probes the sender sent.
How long does a sender keep probing?
As long as probes are answered, a zero window is a legitimate state: the receiver is alive, just busy. RFC 9293 requires the sender to keep the connection open in that case, indefinitely. Probes that go unanswered are treated like retransmissions and eventually time out (tcp_retries2, article 65).
That rule can be abused: a client that opens many connections, requests large responses and never reads ties up server memory. RFC 6429 clarifies that a sender may let the application or the system abort such connections. On Linux, TCP_USER_TIMEOUT applies here too. With a 5,000 ms user timeout on the server and a client that didn't read for 9 seconds:
port 8081: send failed: [Errno 110] Connection timed out
client: [Errno 104] Connection reset by peer after 9.0 s
The server's send() failed with ETIMEDOUT even though every probe was answered, and the client found the connection reset when it finally read.
Silly window syndrome
Now suppose the receiving application reads only a little at a time. A naive receiver would advertise every few freed bytes, and the sender would fill each tiny window at once, so the connection would carry a stream of tiny segments, each mostly headers. That's silly window syndrome (SWS), and both ends take part in avoiding it (RFC 1122, RFC 9293):
- The receiver doesn't advertise a larger window until it can grow by at least one full segment or half its buffer, whichever is smaller. Until then, it keeps advertising the old (possibly zero) window.
- The sender doesn't send a small segment unless it can send a full one, or it has nothing else to send and nothing outstanding (the Nagle rule, article 68), or the window would allow at least half of the largest window the receiver has ever offered.
The diagram below compares the two behaviors.

The lab's client switched, after 8 seconds, to reading 200 bytes every 20 ms. The client's ACKs during that phase:
8.099 s client ACK 59369 window 0
11.254 s client ACK 59369 window 17376
11.277 s client ACK 60817 window 15928
11.298 s client ACK 73849 window 7240
11.324 s client ACK 81089 window 2896
11.365 s client ACK 83985 window 0
11.639 s client ACK 83985 window 0
12.156 s client ACK 83985 window 0
For more than 3 seconds of small reads, the client kept answering probes with a zero window. Only when it had freed a large part of its buffer did it advertise 17 KB at once. Then each ACK's window shrank by the data that had just arrived: from 17,376 to 15,928 after one 1,448-byte segment (ACK 59,369 to 60,817), and so on down to 0. The server filled it with full-size segments, the window closed again, and the probes resumed, starting again from the short initial interval. Linux is more conservative than the minimum rule: it holds the window closed until a substantial share of the buffer is free, which keeps segments full.
Common questions
Is a zero window an error?
No. It's normal flow control, telling the sender to wait. It becomes a problem only if it lasts, which points to an application that has stopped reading, not to the network.
What's the difference between the receive window and the congestion window?
The receive window is advertised by the receiver and protects its buffer. The congestion window is computed by the sender and protects the network. The sender may have at most the smaller of the two in flight.
Why did Linux report double the SO_RCVBUF I asked for?
Linux doubles the value to allow for bookkeeping overhead, as its socket(7) manual page documents. Only part of the buffer is offered as window, because each received segment uses more memory than its payload.
Can a receiver shrink its window?
It's strongly discouraged, because the sender may already have sent data into the space being withdrawn. Senders must handle it: they stop sending beyond the new right edge and don't treat the extra data as lost. Linux never shrinks the window by default (net.ipv4.tcp_shrink_window = 0, added in Linux 6.5).
Can probes keep a dead connection alive forever?
Only if they're answered, which means the peer isn't dead. Unanswered probes time out like retransmissions. To limit how long a live peer can hold a connection with a closed window, set TCP_USER_TIMEOUT.
Summary
- The advertised window limits how much unacknowledged data a sender may have in flight, so a slow receiver is never overrun. It slides right as data is acknowledged and opens as the application reads.
- When the receiver's buffer fills, it advertises a zero window and the sender stops. In the lab, the window closed within 0.3 seconds of the client stopping reads.
- The sender's persist timer sends window probes so a lost window update can't deadlock the connection. The probes backed off exponentially, from about 0.3 s up toward 120 s.
- Answered probes keep a connection open indefinitely, unless
TCP_USER_TIMEOUTis set, which aborted the lab connection after 5 seconds. - Silly window syndrome avoidance keeps segments full: receivers advertise only worthwhile windows, and senders avoid tiny segments. In the lab, small reads left the window at zero until 17 KB could be offered at once.
Practice questions
1. A receiver's window is 20,000 bytes, and the sender has 12,000 unacknowledged bytes in flight. How much more can the sender transmit, ignoring congestion control?
Answer
8,000 bytes. The window counts from the oldest unacknowledged byte, so 12,000 of the 20,000 are already used.
2. A receiver advertises a zero window, then frees its whole buffer and sends a window update, which is lost. What happens next?
Answer
The sender keeps sending window probes on its persist timer. The next probe is answered with an ACK carrying the open window, and the transfer resumes. Without probes, both sides would wait forever.
3. Why do persist probes back off exponentially instead of being sent at a fixed rate?
Answer
A long zero window usually means the receiving application is busy or stalled, so frequent probes would waste capacity for nothing. Backing off keeps the cost of a long stall low while still detecting a reopened window quickly when the stall is short.
4. A receiving application reads 50 bytes at a time from a connection with a 1,460-byte MSS and a 64 KB buffer. Without SWS avoidance, what would the traffic look like, and what does avoidance change?
Answer
Without avoidance, the receiver would advertise about 50 new bytes after each read, and the sender would send 50-byte segments, each with 40 or more bytes of headers. With avoidance, the receiver keeps the window closed until it can offer at least one MSS (1,460 bytes) or more, and the sender sends full-size segments.
5. A server's connections pile up with large notsent values and timer:(persist,...) in ss. What's happening, and how can the server protect itself?
Answer
Those clients have zero windows: they've stopped reading, so the server's data waits in its send buffers while it probes. That may be slow clients or a deliberate attack. The server can set TCP_USER_TIMEOUT or application-level timeouts to abort connections that make no progress, and limit per-client resources.
Previous: Interactive Traffic: Delayed ACKs, the Nagle Algorithm and TCP_NODELAY
Next: Large Windows and Buffers: Bandwidth-Delay Product, Auto-Tuning and Urgent Data

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.