TCP occurs with RST status collation

Source: Internet
Author: User

Normally the TCP four layer handshake closes the connection, and the RST is basically an anomaly, organized as follows:

1. GFW

2. The opposite port is not open and occurs when the connection is established

If the other side sync_backlog full, sync is simply discarded, acting as timeout, not rst

3. Recv buffer is not empty when close Socket

For example, the client sends two requests, the server closes the connection only after the first request is processed from buffer, the TCP layer considers the data not being submitted correctly to the application, and uses the RST to close the connection.

3. Move the link

Mobile network, the domestic is 5 minutes after the recovery of the signaling, that is, IM products, if the heartbeat >5 minutes after the server sends a message to the client, you will receive the RST. Also check the mobile network im to keep <5min heartbeat.

4. Load and other equipment

The load device needs to maintain the connection forwarding policy, for a long time without traffic, the connection will be cleared, and many do not tell the two-tier machine, the new package comes over when the RST is advertised.

The Apple push service also has this problem, and it is unpredictable that the occasional connection was rst;rst before the first message write was successful, and the second write would tell you that the connection was reset,

Once it was frustrating, so open every 2 seconds TCP keepalive, fixed a 5-minute TCP connection recovery, and found that the connection error, the message before the re-send 10s.

5. So_linger app Force use rst off

This option discards the send buffer that is not sent, which can cause business errors, and, of course, the Intranet service between the HTTP client should be actively closed when it is received, and the use of re-election items will save resources.

Seems to have tested haproxy some configuration, will use RST to close the connection, less network interaction and no time_wait problem

6. Over-time retransmission times, network temporarily unreachable

7. Time_wait Status

Tw_recycle = 1 o'clock, sync timestamps than last hour, will be rst

7. Set Connect_timeout

The app sets a connection timeout, the sync does not complete when it times out, and the RST termination connection is sent.

8. Non-normal package

Connection is closed, seq is incorrect, etc.

9. KeepAlive Timeout

The Public Network Service TCP keepalive best not to open, the mobile network will increase the burden of the network, cut off the line, non-mobile network core ISP devices are not necessarily support keepalive, once also found that there is a core node in Guangzhou is not supported.

10. Waiting to be sorted

Reference:

Setsockopt:so_linger option setting (GO)

The case of RST in several TCP connections

TCP occurs with RST status collation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.