patchlwIP - A Lightweight TCP/IP stack - Patches: patch #9734, fix TCP_CLOSE in high load...

 
 

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

patch #9734: fix TCP_CLOSE in high load applications

Submitted by:  Dainius Zilys <vakaras>
Submitted on:  Fri 14 Dec 2018 09:08:41 AM UTC  
 
Category:  TCP Priority:  5 - Normal
Status:  Invalid Privacy:  Public
Assigned to:  Simon Goldschmidt <goldsimon> Open/Closed:  Closed
Planned Release:  None

Tue 18 Dec 2018 06:22:32 AM UTC, comment #2: 

Yes, you could be right. I did not sent new arrived packets to tcpip_thread() via tcpip_input(), but directly to the ethernet_input() from another thread. So multitasking issue happened.
The patch can be ignored.

Dainius Zilys <vakaras>
Mon 17 Dec 2018 08:20:36 PM UTC, comment #1: 

There must be something wrong in your description:
- 'recv_tcp' is the callback called inside tcpip_thread to receive data for TCP netconns/sockets
- as it runs in tcpip_thread, there can be no other thread freeing the pcb while 'recv_tcp' is running

Do you mean the netconn (not pcb) is freed while 'recv_tcp' is running? There have been improvements in this direction for 2.1.0, which version of are you running?

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 14 Dec 2018 09:08:41 AM UTC, original submission:  

api_msg.c file:

When a TCP socket has a CLOSE_WAIT state, the  recv_tcp() function sends a message to tcpip_thread() to close the socket. After that, function continues to work the pcb, calls API_EVENT().

In a high load CPU usage and high Ethernet bitrate, OS switches to tcpip_thread() just after the post, which releases pcb BEFORE the API_EVENT() has been executed. This memory block becomes free, and a new Ethernet packet arrives into the pcb location. So we have a hard fault.

Resolution: to call the API_EVENT() before the sys_mbox_trypost()

Dainius Zilys <vakaras>

 

Attached Files
file #45648:  tcp_close_api_msg.patch added by vakaras (950B - application/octet-stream - A patch to fix tcp close)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Updated the item)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by vakaras (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-18 dziegel StatusWorks For Me => Invalid
        Open/ClosedOpen => Closed
    2018-12-17 goldsimon StatusNone => Works For Me
        Assigned toNone => goldsimon
    2018-12-14 vakaras Attached File- => Added tcp_close_api_msg.patch, #45648

    Back to the top


    Powered by Savane 3.5