fjpanag commented on PR #6956: URL: https://github.com/apache/incubator-nuttx/pull/6956#issuecomment-1235308463
> > Repeating the experiment multiple times I got a failed assertion @ `tcp/tcp_conn.c`, line 770. > > @fjpanag , > > Thanks a lot for your detailed analysis! From the callstack you shared, it should be that the conn waiting to be released is reused as a fall-back conn: > > https://github.com/apache/incubator-nuttx/blob/master/net/tcp/tcp_conn.c#L638-L676 > > I think here should add some sanity check before tcp_free(): > > ``` > $ git diff . > diff --git a/net/tcp/tcp_close.c b/net/tcp/tcp_close.c > index fb1e9015d7..dca09c267e 100644 > --- a/net/tcp/tcp_close.c > +++ b/net/tcp/tcp_close.c > @@ -53,10 +53,13 @@ static void tcp_close_work(FAR void *param) > > net_lock(); > > - /* Stop the network monitor for all sockets */ > + if (conn && conn->crefs == 0) > + { > + /* Stop the network monitor for all sockets */ > > - tcp_stop_monitor(conn, TCP_CLOSE); > - tcp_free(conn); > + tcp_stop_monitor(conn, TCP_CLOSE); > + tcp_free(conn); > + } > > net_unlock(); > } > ``` > > I will update this PR, could you please help with further testing ? No, this is not the root cause. I managed to have the code to enter [this](https://github.com/apache/incubator-nuttx/blob/master/net/tcp/tcp_conn.c#L638-L676) multiple times, but the assertion does not fire. I managed to have the assertion fail again, but before the failure the above code was not executed. There is another problem, elsewhere. -- 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