You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/31 03:37:53 UTC

[GitHub] [incubator-nuttx] anchao commented on a change in pull request #5373: tcp: added debug asserts and logging to investigate the rare (conn->dev == NULL) bug in callback handlers

anchao commented on a change in pull request #5373:
URL: https://github.com/apache/incubator-nuttx/pull/5373#discussion_r795321572



##########
File path: net/tcp/tcp_send_buffered.c
##########
@@ -1145,6 +1168,20 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
       if (psock->s_sndcb == NULL)
         {
           psock->s_sndcb = tcp_callback_alloc(conn);
+
+#ifdef CONFIG_DEBUG_ASSERTIONS

Review comment:
       move the assertion to :
   https://github.com/apache/incubator-nuttx/blob/master/net/devif/devif_callback.c#L354-L359

##########
File path: net/tcp/tcp_send_buffered.c
##########
@@ -376,6 +376,29 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
   conn = psock->s_conn;
   DEBUGASSERT(conn != NULL);
 
+#ifdef CONFIG_DEBUG_NET_ERROR
+  if (conn->dev == NULL || (pvconn != conn && pvconn != NULL))
+    {
+      nerr("ERROR: conn->dev == NULL or pvconn != conn:"
+           " dev=%p pvconn=%p pvpriv=%p flags=0x%04x"

Review comment:
       create the new file named tcp_dump.c and unify the tcp connect dump ?

##########
File path: include/nuttx/net/net.h
##########
@@ -270,6 +270,10 @@ struct socket
   /* Callback instance for TCP send() or UDP sendto() */
 
   FAR struct devif_callback_s *s_sndcb;
+
+#ifdef CONFIG_DEBUG_ASSERTIONS
+  int s_sndcb_alloc_cnt;     /* The callback allocation counter */

Review comment:
       add the assertion to 
   https://github.com/apache/incubator-nuttx/blob/master/net/devif/devif_callback.c#L354-L359




-- 
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-unsubscribe@nuttx.apache.org

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