[Top][All Lists]
[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: |
Tue, 20 Sep 2011 15:58:21 +0200 |
Currently, I found the bug. It was a stupid typo in my file sys_arch.c My
function sys_arch_mbox_tryfetch returned sometimes a wrong value…
Many thanks for your support!
Stefan
> On Sat, 2011-09-17 at 15:51 +0200, Stefan Lankes wrote:
>>
>>>
>>> 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.
>
> How does your device driver pass packets to lwIP? There have been
> problems in the past where people have not used that interface
> correctly.
>
>> 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".
>
> That suggests that something is trying to free an invalid pointer.
> Again this points at state corruption. I wonder if you have problems
> with stack overflow on your system or something like that?
>
> Kieran
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users