anchao commented on PR #6956:
URL: https://github.com/apache/incubator-nuttx/pull/6956#issuecomment-1237178894

   Hi @fjpanag ,
   
   Could you please confirm whether tcp_alloc uses the fall-back connection 
instance when the assert() triggered? 
   
https://github.com/apache/incubator-nuttx/blob/master/net/tcp/tcp_conn.c#L638-L704
   (perhaps you need to add some debug logs to track the pointer of "conn"), I 
guess the issue you encounter maybe as blew:
   
   ```
   1. tcp_close ready and queue the lpwork to free the resources:
   net/tcp/tcp_close.c:
   tcp_close_eventhandler
   |
    ->work_queue  (LPWORK priority 100)
    
   2.  High priority task( > 100) open socket and allocate the tcp_conn 
instance,
        no free connections and fall-back to active list to found out the close 
pending instance
   
   socket
   |
    ->tcp_alloc /* conn->crefs++ 
*/(https://github.com/apache/incubator-nuttx/blob/master/net/tcp/tcp_conn.c#L638-L704)
    |
      ->connect
   
   
   3. High priority task blocked on connect(), task yield to lpwork, 
   tcp_close_work()
   |
    ->tcp_free()
        |
          ->assert()  (conn->crefs > 0)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to