What is Silly Window Syndrome – Explanation and Prevention

Data is transferred over the network and Internet using the TCP/IP Protocol. The TCP/IP is not perfect but is easier to implement compared to other protocols theorized for data communication… such as ISO OSI model. As with any technical thing, TCP/IP has some flaws too and Silly Window Syndrome is a creation of one of those flaws. To understand what is Silly Window Syndrome or SWS, you will first need to understand the underlying mechanism of data communication in TCP/IP.

Silly Window Syndrome

silly window syndrome

Understanding the window and its size

When two points are communicating under TCP/IP, it involves an acknowledging mechanism. This acknowledging mechanism is what causes Silly Window Syndrome as explained further. Points may refer to two computers, client and server etc.

SWS is caused by the receiver advancing the right window edge whenever it has any new buffer space available to receive data and by the sender using any incremental window, no matter how small, to send more data. The result can be a stable pattern of sending tiny data segments, even though both sender and receiver have a large total buffer space for the connection, says MSDN.

When a computer, say A, sends a data packet to another computer B, the latter has to acknowledge and reply that it received the data packet. Along with the acknowledgement, it also has to send the size of buffer set apart for that communication thread. This is generally the number of bytes set free for communication.

So when B says 100B is available for the next message, the 100B is the window in Silly Window Syndrome. That is, it is the buffer size. With its own flaw, TCP/IP mechanism may reduce the buffer size for each communication/data coming from A. That is, whenever A sends a message, B assumes the buffer size is reduced and sends a smaller number. Thus the window size keeps on reduced and at a point, the communication just stops as B sends 0B as window size.

How Does Silly Window Syndrome Work

According to the above example of A and B, if B sends 1000B as window size, A will split it into two 500B and send two packets of 500B. Upon receipt of first packet, B will send an acknowledgement saying 500B is available for the window as the second packet is yet to be received. A assumes 500B is the window size and send two packets of 250B consequently. While at B, 500B is used and 500 is just received, it will send 0B as available. At this point, A will assume no window is available though it might happen that buffer is empty as the processor used up the data there. A will still send a smaller packet to see if any window is available. If the contents of buffer at B are not yet removed, it will still receive 0 as response/acknowledgement.

Thus, the window size keeps on reducing as B sends acknowledgement every time it receives a packet from A. This size is usually smaller than previous acknowledgement as B is receiving data packets in parts. There would be no problem if A could send a packet big enough to cover the buffer size on B at a time. But that is would require additional mechanisms and hence Silly Window Syndrome. The communication stops after A receives 0 two or three times.

How to prevent Silly Window Syndrome (SWS)

There is a simple algorithm to be implemented to get rid of SWS. Upon receiving initial packet, B sends half the really available space as the window. That will make A send smaller packets. Consequently, when the packets become too smaller, then B sends the total buffer size so that A can start sending bigger data bytes again.

In other words, if 1000B is available, B sends 500B as acknowledgement. Accordingly, A sends 250B x 2 packets. For this, A receives 100B as acknowledgement. When it receives 50B packet, B sends 1000B – 50B to A. That makes the entire conversation operational again. This might induce a little delay in processing but will prevent Silly Window Syndrome from occurring and stopping the entire conversation.

To sum up, SWS is based on the buffer size available on recipient and the assumed size calculated by the sender. To prevent SWS, a delay is introduced and deliberate smaller window size is reciprocated until packet size becomes too small. Then the recipient discloses actually available window size. The entire process keeps on repeating until the communication is complete.

Although I may have used the words window and buffer interchangeably. I do not mean any difference between them. In SWS studies, buffer is the window.

If you need more information, there is a detailed explanation available here on tcpipguide.com.

Posted by on , in Category General with Tags
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP Awardee in Windows (2006-16) & a Windows Insider MVP. Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.