[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] [mqtt] Disconnection caused by a keep-alive timeout
From: |
Benjamin Kalytta |
Subject: |
Re: [lwip-devel] [mqtt] Disconnection caused by a keep-alive timeout |
Date: |
Thu, 3 Dec 2020 09:54:21 +0000 |
I don't know if my problem is related since I relied on Netconn API.
In that case, my embedded device was running a HTTP web server. Clients
connected through Wi-FI to my device. AJAX requests were heavily used i.e. many
connections opened and closed very often. As soon as the client (running on
Microsoft Windows) loses the Wi-FI connection Windows automatically shuts down
all active TCP/IP connections since this network interface wasn't available any
more (This should not be conform to the TCP/IP specification!). However, the
embedded device did not notice that the connections on the opposite side were
already closed, so no pool memory were ever freed. When the Wi-FI connection
reestablished, and the client tries to reconnect, no more memory was available
to handle that client requests.
My solution was to enable TCP/IP keep-alive per connection and setting a
reasonable short timeout. Following configuration has to be set for that to
work reliably:
#define LWIP_NETCONN_FULLDUPLEX 1
#define LWIP_NETCONN_SEM_PER_THREAD 0
- Re: [lwip-devel] [mqtt] Disconnection caused by a keep-alive timeout,
Benjamin Kalytta <=