[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] "Simultaneous" close by server & client causes memp_fre
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] "Simultaneous" close by server & client causes memp_free error |
Date: |
Mon, 28 Mar 2011 17:02:52 +0200 |
Dave Harper <address@hidden> wrote:
> Following this is a loop that will call tcp_close() and keep
> doing so if it gets a return status of ERR_MEM. The PCB state at this
> point
> is ESTABLISHED. The tcp_close() function executes the "tcp_send_ctrl(pcb,
> TCP_FIN)" statement but, in the failing situation, this returns an ERR_MEM
> error from tcp_enqueue(). This happens several times. In the meantime,
> an
> input from the browser results in tcp_input() determining that the
> connection has been closed so it calls tcp_pcb_remove(), which results in
> the state being set to CLOSED, and then deallocates the PCB. Shortly
> after
> this the tcp_close() executes again but this time, since the state is now
> CLOSED it executes that case statement.
This discription suggests that there is more than one task active in lwIP. I
guess you are calling tcp_close() from the main task and tcp_input() from the
ETH interrupt handler. It has been stated many times that there must only be
one task active in the lwIP core. Failing to follow this rule can produce many
errors.
Given that there is only one thread active in lwIP at a time, "simultaneous"
close can never happen since everything is serialized.
Simon
--
NEU: FreePhone - kostenlos mobil telefonieren und surfen!
Jetzt informieren: http://www.gmx.net/de/go/freephone