Hello.
Our application running SDK 2.13.0 on RT685 is sporadically failing an assert on line 565 of lwip/src/api/sockets.c:
LWIP_ASSERT("sockets[i].select_waiting == 0", sockets[i].select_waiting == 0);
It happens after wlan is connected and a socket is created. It only happens sometimes and only when creating the second socket. Perhaps between 1-in-10 or 1-in-20 times, so it's difficult to reproduce.
The socket is being created from a FreeRTOS task and there are no other tasks attempting to access or close the socket. The total number of sockets is currently configured as 18.
For some reason, execution doesn't automatically stop in MCUXpresso IDE, but the assert shows up in the log and the IDE hangs there. Once I press the "Suspend" toolbar button, I can see the callstack stopped at:
- sys_assert()
- alloc_socket()
- socket()
- ...
However, when watching sockets[1] in the Expressions view, select_waiting is already zero. So perhaps it has been cleared from another task or interrupt.
I don't see how select_waiting has been incremented since the socket is in the process of being created and no other tasks should be using the socket or calling select.
I saw a forum post pointing to a related fix but it seems this patch has already been applied:
lwip.git - lwIP - A Lightweight TCPIP stack (nongnu.org)
Any ideas as to what could be happening?
Thank you.