Hi all,
Recently when I am working on LWIP to do some stress test, e.g.
continuously uploading data to a server via TCP connection, the device
often crashed on an assert statement in tcp_receive(),
if (pcb->snd_queuelen != 0) {
LWIP_ASSERT("tcp_receive: valid queue length", pcb->unacked !=
NULL ||
pcb->unsent != NULL);
}
After debugging the crash case, I found some possible cause that the pcb
structure has been corrupted by another thread during a context switch.
I singled out one likely candidate, tcp_slowtmr(). In this timer, it
calls another function tcp_pcb_purge(), in which it resets both unacked
and unsent queue to NULL but without setting queuelen to 0. In some
cases (like tcp state is FIN_WAIT_2), this timer will interrupt the
current tcp thread in a preemptive OS environment, modifying the current
pcb before hitting the assert statement afterwards.
How likely will it be if so? Has anyone encountered a similar issue? Any
suggestions?
Thanks,
Jackie
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users