[bug #56161] TCP state stays FIN_WAIT_1/CLOSING

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #56161] TCP state stays FIN_WAIT_1/CLOSING

Wilfred
URL:
  <https://savannah.nongnu.org/bugs/?56161>

                 Summary: TCP state stays FIN_WAIT_1/CLOSING
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: yuanx
            Submitted on: Thu 18 Apr 2019 12:01:15 PM UTC
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.0.3

    _______________________________________________________

Details:

A TCP connection always stays in  FIN_WAIT_1/CLOSING while network
faults happening like net cable plugging out, which makes tcp pcb cannot be
released. The following is my modification in function tcp_slowtmr:

The original code:

  if (pcb->state == LAST_ACK) {
      if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) {
        ++pcb_remove;
        LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in
LAST-ACK\n"));
      }
    }

My code:

if (pcb->state == LAST_ACK || pcb->state == FIN_WAIT_1 || pcb->state ==
CLOSING) {
      if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) {
        ++pcb_remove;
        LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in
LAST-ACK\n"));
      }
    }





    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56161>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #56161] TCP state stays FIN_WAIT_1/CLOSING

Wilfred
Update of bug #56161 (project lwip):

                  Status:                    None => Need Info              

    _______________________________________________________

Follow-up Comment #1:

FIN_WAIT_1 (and I guess CLOSING too) is tied to the regular TX TCP timeout, so
it should timeout sooner or later, what do you really mean by stay in
FIN_WAIT_1/CLOSING ?

What you are doing is without doubt a violation of TCP RFCs.


    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56161>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #56161] TCP state stays FIN_WAIT_1/CLOSING

Wilfred
Update of bug #56161 (project lwip):

                  Status:               Need Info => Invalid                
             Assigned to:                    None => goldsimon              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #2:

This is indeed invalid from a TCP state machine point of view. I can see a
need for this for applications not using half-closed connections, though. But
please, if we do someting here, it must be done in a way that doesn't violate
the standards and doesn't break using half-open connections.

The suggested patch certainly does not work. The connection should eventually
time out just as a full-open connection. If that's too slow, you can always
set a linger timeout.

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56161>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #56161] TCP state stays FIN_WAIT_1/CLOSING

Wilfred
Follow-up Comment #3, bug #56161 (project lwip):

Hi, I think the timeout value for FIN_WAIT_1 should be shorter than the normal
timeout value for established state. In Linux, if the initial RTO was 200ms,
then only 8 times was tried for FIN_WAIT_1 state before the tcp connection was
destroyed, but it was 15 times for ESTABLISHED state. pls refer the sysctl
parameter "tcp_retries2" and "tcp_orphan_retries" for more info.  

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?56161>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel