星期三 六月 15, 2005 | Kacheong Poon's Weblog 潘嘉昌的Weblog |
|
When people check out the TCP source code in OpenSolaris, they may find that some pieces of the code do not follow exactly as specified in the various RFCs. Here is an example and the reason why Solaris deviates from the RFCs. On page 72 of RFC 793, the criteria on updating the TCP send window is specified as the following. If SND.UNA < SEG.ACK =< SND.NXT, the send window should be
And on page 94 of RFC
1122, the first condition above is corrected to
In Solaris, we use a different check. See the following piece of
code in usr/src/uts/common/inet/tcp/tcp.c
The check
is modified to be
Without the change of conditions, a combination of zero window and
segment drop can cause a deadlock in TCP. The reason is that
according to the RFCs, TCP does not use window update in out of order
segments (retransmitted segments because of drop are out of order), yet
the ACK field in those segments is processed. This can cause a
sender A to send more than the other side's (B's) receive
window. This is because the ACK field moves the left edge
of the window forward, but as the window update (being 0) in the same
segment is not used, TCP will continue to use the old send window which
is bigger. Thus from A's perspective, the whole send window moves
forward. Those out of window segments will be dropped by B.
And once A sends beyond B's receive window, all ACKs from
A to B will also be dropped by B because they are out of window (TCP
uses
the latest sequence number in ACK segments). In a bi-directional
transfer, this means that B will keep on retransmitting its data as
those ACKs from A are not acceptable. This connection will be
hung. Note that this is not a problem in uni-directional transfer.
Technorati Tag:
OpenSolaris
Trackback URL: http://blogs.sun.com/kcpoon/entry/solaris_tcp_window_update
Post a Comment: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Posted by Giorgos Keramidas on 六月 16, 2005 at 08:58 下午 HKT #
We have a java issue that seems to correspond with this description.
We run a J2Me (CDC pprof1.1) project on a Motorola Device - the JVM is IBM's J9.
The Client App on the Motorola device communicates with the Server using TCP/IP Sockets, thru which we transmit/receive XML. The socket is kept continuously open.
At apparently completely 'random' intervals the TCP/Ip protocol seems to fail (Socket connection is still active - no reset) BUT Client/Server simply stop 'talking'.
Any ideas ??? The project is completely wrecked by this behaviour.
Posted by gordon wilcox on 六月 12, 2009 at 05:26 下午 HKT #