lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] tcpip thread gets stuck when socket is closed


From: Stefan Lankes
Subject: Re: [lwip-users] tcpip thread gets stuck when socket is closed
Date: Mon, 19 Sep 2011 07:31:25 +0200


> 
> 
>> 
>> On 15 Sep 2011, at 15:43, Stefan Lankes wrote:
>> 
>>> we use LwIP 1.4.0 as TCP/IP stack for an internal OS project. We have 
>>> already tested some applications, which used the LwIP's Socket API - they 
>>> work fine. However, if the applications close the socket, the tcpip thread 
>>> gets stuck and isn't able to handle incoming messages. To analyze this 
>>> behavior, we defined the macro LWIP_TCPIP_THREAD_ALIVE to print some 
>>> messages periodically on the screen. This stops by closing the socket. 
>>> 
>>> Do you have any idea, why the Socket API doesn't work correctly?
>> 
>> You've probably violated lwIP's threading constraints and corrupted some 
>> internal state such that the tcpip thread gets stuck in a loop.  If you can 
>> describe all the different threads you have and how they interface to lwIP 
>> that would probably reveal the problem.
>> 
>> Kieran
> 
> I read that the some users has similar problems. Most of these users violated 
> the LwIP's threading constraints. Therefore, I created only one thread which 
> realized a simple socket-based server. Like the Unix port, the tcpip thread 
> initialized in its callback the NICs. Beside these threads, my system has 
> also an idle thread and an initd thread, which creates my server example and 
> terminates.
> 
> On a real machine, the tcpip thread stucks when the socket is closed. I 
> tested my code also on qemu. By closing a socket, I got the assertion 
> "men_free: legal memory failed at line 320 in lwip/src/core/mem.c".
> 
> Any idea?

By the way, I am using the netifapi to initialize the NICs and I switched to 
the netconn example "tcpecho" to avoid problems with my own test program. 
However, I got the same behavior.

Stefan



reply via email to

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