lwip stm32 - http requests failing

2020-06-29 14:18发布

问题:

I running freeRTOS and lwip 1.4.1 with the socket api in use on an stm32 processor (stm32f407). Overall it works pretty fine. I can send and receive data with udp and tcp.

But in a timewindow of 3 to 7 days I see a strange behavior.

My Problem

Every 3 to 7 days my client (Windows 10, which sends 1-2 HTTP-Requests per second) fails to send those requests. When this happens, there are ~10 Requests successively, which are failing. In very few moments, the stack won't regenerate at all.

My Guess

I think I have possibly missconfigured something in my LWIP config. Because the stack is well used and shouldn't have any bugs in this direction

My Ethernet settings

server and client are directly connected, no switch,hub or router in between.

server (stm32/lwip):

  • static, 192.168.168.2
  • netmask, 255.255.255.0

client (win10) eth0:

  • static, 192.168.168.1
  • netmask, 255.255.255.0

client (win10) eth1:

  • dhcp, to normal working network

My Tries

At the moment I have tests running which are sending ~7-8 Requests per second, but the error doesn't apply more often. I played around with the lwip config:

  • more memory for the stack
  • more pbufs
  • bigger pbufs
  • with/without backlog

But everything without improving of this connection problem. Could it be because of the often reused port numbers from the client, which could make this problem?

Here I have the relevant part of the lwip debuging output:

tcp debugging output

https://pastebin.com/a9JabhET

Here the Wireshark log:

orig screenshot

hole wireshark log:

https://www.file-upload.net/download-12682664/debug_tcp_00001_20170828172950.html

And here my lwipopts.h:

lwip configuration:

https://pastebin.com/cW0v4hF6

回答1:

It seems a memory problem, but as it is temporary, it could be a timeout on something. I suggest to use the memory stats functions of LwIP, and also to enable the ARP debug messages.