The system is using FreeRTOS and LwIP, and there is a sporadic issue where the program gets stuck in the select function.
My program uses two network interfaces, one for PPP dial-up to access the external network, and the other using Ethernet. I have two tasks that call select: one to monitor the read fd for all sockets, and another when writing data to Ethernet, to monitor its write fd. If the select call fails during the write operation, it suggests that LWIP may be running out of memory, and I refrain from writing.
After running the program overnight, it typically gets stuck after seven to eight hours, with both tasks stuck inside the select function. How can I pinpoint the issue, as it's difficult to reproduce and appears to be related to the non-reentrant nature of select?
I've noticed two macro definitions:
LWIP_NETCONN_SEM_PER_THREAD and
LWIP_NETCONN_FULLDUPLEX. Would enabling these macros help avoid this situation?
I have also observed that when a socket being monitored by select is closed by another task before the select call reaches its timeout, the socket cannot be properly reclaimed. Is this also related to these two macro definitions?
I would greatly appreciate the assistance you have provided.