lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] LWIP - TCP receive assert failed


From: address@hidden
Subject: Re: [lwip-users] LWIP - TCP receive assert failed
Date: Fri, 16 Jan 2015 21:47:06 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

Jackie:
After stress test and debugging, more than 10 hours uploading data, I found the PCB got corrupt in tcp_output(). The case is that tcp_output() can be blocked by the lower-level function call in tcp_output_segment(), in which somehow the buffer of lower-layer protocol is full, so the upper-layer is pending, and at the same time, tcp timer is running,  tcp_slowtmr() is also calling tcp_output(), so this tcp_output() is called before the

There you got the bug: when lwIP's threading requirements are observed, this can't happen: tcp_output() can never be called twice and thus does not have to be designed reentrant.

What you describe tells us that timers are checked from a different execution thread (thread or ISR) than output. But for the core lwIP code, you have to ensure this doesn't happen. That's all.

Of course this raises the problem of what to do with TX packets when e.g. your DMA queue is full. Usually it's best to add a 2nd (larger) software-queue that fills the DMA queue and to keep an upper limit on it. You'd then return ERR_IF when this limit is reached.

Simon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]