buglwIP - A Lightweight TCP/IP stack - Bugs: bug #56487, [v2.1.2] crash when TCP continuous...

 
 

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

bug #56487: [v2.1.2] crash when TCP continuous write encounter wifi disconnect

Submitter:  Song Pu <pusong666>
Submitted:  Thu 13 Jun 2019 08:19:56 AM UTC
   
 
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Crash Error Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.1.1

Tue 25 Jun 2019 06:20:00 PM UTC, comment #3: 

As David already said it, you're doing things wrong. Closing as invalid.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 21 Jun 2019 01:56:56 PM UTC, comment #2: 

`netif_set_addr()` calls LWIP_ASSERT_CORE_LOCKED(). So this function MUST be called from the Lwip task, not your wifi task.

Use `netifapi_netif_set_addr` is you require changing the ipaddr from another task.

David GIRAULT <dgirault>
Sat 15 Jun 2019 01:47:28 AM UTC, comment #1: 

Further explanation:

1. TCP Socket write large data in TaskA
2. disconnect wifi -> "wifi_disconnect" callback then netif_set_addr(sta_if, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY) in TaskB(wifi task is higher priority.)
3. TaskA may be switch to TaskB when TaskA is running lwip_netconn_do_writemore  "conn->current_msg->msg.w.offset += len" or "sys_sem_t *op_completed_sem = LWIP_API_MSG_SEM(conn->current_msg)".
But TaskB netif_set_addr->netif_do_ip_addr_changed->tcp_netif_ip_addr_changed_pcblist->tcp_abort->err_tcp->conn->current_msg=NULL.

Song Pu <pusong666>
Thu 13 Jun 2019 08:19:56 AM UTC, original submission:  

reproduce ratio:
seldom

lwip option:
enable socket etc.
enable LWIP_TCPIP_CORE_LOCKING

reproduce step:
1. TCP Socket write large data continuously
2. disconnect wifi, then our code will handle "wifi_disconnect" event to netif_set_addr(sta_if, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY)

result:
crash due to conn->pcb or conn->current_msg == NULL in lwip_netconn_do_writemore


Song Pu <pusong666>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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 goldsimon (Posted a comment)
  • -email is unavailable- added by dgirault (Posted a comment)
  • -email is unavailable- added by pusong666 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-25 goldsimon StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code