Possible problem with client using lwip

btomic
Posts: 2
Joined: Fri Apr 06, 2018 10:06 am

Possible problem with client using lwip

Postby btomic » Sun Feb 10, 2019 8:37 pm

Hello,

I am using FreeRTOS and lwip library to connect to a remote server. I have a client task which calls a function to send some data to the server. The function has a standard sequence of calling gethostbyname(), then socket(), connect(), write(), read() and eventually close().

The task is in the 30-second loop which means the function is called twice in a minute. The task runs perfectly for several days and then it gets stuck. I see it because after each passed loop I blink the blue LED for 500 ms and I see that it blinks once every 30 seconds for several days before it stops blinking.

However, when it gets stuck, if I power-down my router the task gets unstuck immediately! I can see that because I set a flag in the wifi event handler callback function when the connection is lost and I test this flag at the beginning of the task loop. If the flag is set it makes the blue LED blink fast and it really blinks like that for as long as the router is powered down. This means that the task is unstuck by the loss of the wifi connection!

When I power-up the router I see that the LED stops fast blinking and starts blinking again only once in 30 seconds (of course it first blinks every few seconds until the vTaskDelayUntil catches up with its time). I also see that the messages to the server go through again. It works fine again for several days until it gets stuck again.

One of the messages that go to the server is a heap size and I can see that it is stable and unchanged.

Does anyone know how (if at all) the lwip can get stuck and how to fix this?

Thanks

Who is online

Users browsing this forum: Baidu [Spider] and 18 guests