|Subject:||[lwip-users] netcon_recv hangs|
|Date:||Wed, 2 Nov 2011 16:05:50 +0530|
I am facing hang issue on my system.
I am using Atmel port of LWIP 1.3.2 with freeRTOS over AT32UC3A0512 (atmel) controller.
Here is a problem description.
I have a web server, dhcp server and two web clients (one over PC and other over controller) all connected via hub. Web client task running on my controller simply creates a socket connection, sends a GET HTTP request, reads the data and closes the socket. The other tasks running in the system are ethernet and tcpip. The PC web client is continuously requesting an image file (large size) from web server. Everything works fine if I do not have the web client task running. All the unwanted packets that the controller receive (I am using hub) are discarded by the tcpip task. However, as soon as I start the web client task the system hangs within couple of minutes.
I see that the issue comes because pbuff_alloc() call in low_level_input function in ethernetif.c fails to return a valid pointer. Due to this Ethernet task fails to post a message while other tasks are pending on the message queue to receive a message. The pbuff_alloc() calls memp_alloc which is an array of fixed size memory pools. When the system hangs looking at the stats_mem structure in _lwip_stats indicate lot of errors (err value in thousands) for PBUF_POOL type. I tried to increase the buffer size but that did not help.
I tried to use PBUF_RAM instead of PBUF_POOL but I get same behavior. Also, tried to make the web client task high priority but it did not solve the problem.
I see that the pbuff memory is freed at various places in tcpip.c depending upon the message type. However in case of socket the memory is freed only when the socket is closed.
Does anybody see any obvious issue here?
read() <-- hangs here
Thanks for your support.
|[Prev in Thread]||Current Thread||[Next in Thread]|