This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
LWIP thread safety
- From: "Rob Duncan" <rob dot duncan at designmagnitude dot com>
- To: ecos-discuss at sourceware dot org
- Date: Thu, 24 May 2007 16:20:19 -0700
- Subject: [ECOS] LWIP thread safety
I've been running into the following assertion failure when I put a
reasonably high load on the LWIP networking stack:
ASSERT FAIL: <6>pbuf.c[577]pbuf_free() pbuf_free: p->ref > 0
According to the LWIP mailing list archives this is typically the
result of incorrect thread protection. So I've been taking a look at
the way that LWIP is configured in eCos. I've found that the LWIP
parameter SYS_LIGHTWEIGHT_PROT is not defined, which means that the
pbuf allocate and free routines are not protected (instead there is a
half-hearted attempt at some locking with some state variables but
it's quite broken). This means that if these routines are called from
multiple threads (which they are), then its only a matter of time
before the pbuf free list or the pbuf reference counts are corrupted.
So, have I misunderstood the implementation? Have I configured eCos
incorrectly and it ought to be using SYS_LIGHTWEIGHT_PROT? Has anyone
else run into this problem and solved it?
Any help is appreciated.
Thanks,
Rob.
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss