patchlwIP - A Lightweight TCP/IP stack - Patches: patch #9601, introduce LWIP_TCP_MAX_TW_BUCKETS...

 
 

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

patch #9601: introduce LWIP_TCP_MAX_TW_BUCKETS to limit timewait socket

Submitted by:  Jin-Seong Kim <jseong>
Submitted on:  Fri 16 Mar 2018 04:44:12 AM UTC  
 
Category:  TCP Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  Simon Goldschmidt <goldsimon> Open/Closed:  Closed
Planned Release:  None

Wed 21 Mar 2018 08:15:01 PM UTC, comment #1: 

A tcp_pcb is allocated by (inderectly) calling 'tcp_alloc()'. The first thing this function will do if allocation fails is to kill a pcb in time-wait state.

If that doesn't work, let's debug it instead of adding more config options.

Also, a pcb in time-wait should not have any segments, pbufs or callbacks attached, so it should only consume one tcp_pcb from the pool.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 16 Mar 2018 04:44:12 AM UTC, original submission:  

Dear. All.

We've found some situation that could be possible to make out of memory on lwIP memory pool.

Test Environment
Test PC (Ubuntu) ---- Wi-Fi  ---- lwIP ported Board (webserver)

Test Procedure
1. Run webserver on board
 - board has 100kB memory pool for lwIP stack
2. Test PC runs wget more than 1000 times repeatedly
3. wget has been stopped and board doesn't create new TCP seesion
   due to lack of memory

As I checked the memory, the lack of memory is caused by the number of tw (timewait) pcbs.
In memory constrained board, it can be quite serious issue.
So, I'd like to review my patch which introduce LWIP_TCP_MAX_TW_BUCKETS to limit timewait socket

Patch description
 - before register tw_tcp_pcbs list, check counter to limit maximum number of tw pcbs
 - if pcb cannot be in tw_tcp_pcbs, it will freed through tcp_free

Unit-Test Results
Running suite(s): IPv4
 UDP
 TCP
 TCP_OOS
 DEF
 MEM
 NETIF
 PBUF
 TIMERS
 ETHARP
 DHCP
 MDNS
 MQTT
 SOCKETS
100%: Checks: 97, Failures: 0, Errors: 0

Thanks

Jin-Seong Kim <jseong>

 

Attached Files
file #43566:  0001-introduce-LWIP_TCP_MAX_TW_BUCKETS-to-limit-timewait-.patch added by jseong (12KiB - application/octet-stream - Base commit is 104a629a51)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by jseong (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.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-21 goldsimon StatusNone => Wont Do
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed
    2018-03-16 jseong Attached File- => Added 0001-introduce-LWIP_TCP_MAX_TW_BUCKETS-to-limit-timewait-.patch, #43566

    Back to the top


    Powered by Savane 3.5