buglwIP - A Lightweight TCP/IP stack - Bugs: bug #54076, tcp: timeout required in...


You are not allowed to post comments on this tracker with your current authentication level.

bug #54076: tcp: timeout required in FIN_WAIT_2 if pcb has been closed

Submitted by:  Simon Goldschmidt <goldsimon>
Submitted on:  Wed 06 Jun 2018 08:10:06 PM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
lwIP version:  git head

Fri 31 Aug 2018 04:16:22 PM UTC, comment #3: 

I think this already exists in tcp_slowtmr.

    /* Check if this PCB has stayed too long in FIN-WAIT-2 */
    if (pcb->state == FIN_WAIT_2) {
      /* If this PCB is in FIN_WAIT_2 because of SHUT_WR don't let it time out. */
      if (pcb->flags & TF_RXCLOSED) {
        /* PCB was fully closed (either through close() or SHUT_RDWR):
           normal FIN-WAIT timeout handling. */
        if ((u32_t)(tcp_ticks - pcb->tmr) >
          LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in FIN-WAIT-2\n"));

Billy Bednar <bb1>
Thu 07 Jun 2018 07:03:20 AM UTC, comment #2: 

> lwIP should consider this half-closed connection to be a normal connection that is still working fine.

It does. That's why we don't have this timeout, yet.

Simon Goldschmidt <goldsimon>
Project Administrator
Thu 07 Jun 2018 07:00:58 AM UTC, comment #1: 

The mailing list discussion with more information starts here:


I just wanted to clarify the comment above about half-closed connections: Say a raw lwIP client connects with tcp_connect() and then shutdowns the Tx side of the connection, because the client expects data to automatically flow upon connection only from the server to the client. lwIP should consider this half-closed connection to be a normal connection that is still working fine.

R. Diez <rdiez>
Wed 06 Jun 2018 08:10:06 PM UTC, original submission:  

Since tcp_alloc() does not kill same-priority pcbs any more (only lower priorities), we need a timeout in FIN_WAIT_2.

However, this timeout must not trigger if the connection has deliberately half-closed (i.e. shutdown was called, not close).

Simon Goldschmidt <goldsimon>
Project Administrator


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bb1 (Posted a comment)
  • -email is unavailable- added by bb1
  • -email is unavailable- added by rdiez (Posted a comment)
  • -email is unavailable- added by goldsimon (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-31 bb1 Carbon-Copy- => Added bb1

    Back to the top

    Powered by Savane 3.7