embedded
network_error
ai_generated
true
lwIP:连接 192.168.1.100:80 的 TCP 重传超时,超过最大重试次数
lwIP: TCP retransmission timeout on connection 192.168.1.100:80, max retries exceeded
ID: embedded/lwip-tcp-retransmission-timeout
80%修复率
84%置信度
1证据数
2023-07-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| lwIP V2.1.3 | active | — | — | — |
| FreeRTOS V10.4.3 | active | — | — | — |
根因分析
TCP 连接因网络拥塞、远程主机无响应或重传缓冲区内存不足而丢失。
English
TCP connection lost due to network congestion, remote host unresponsive, or insufficient memory for retransmission buffers.
官方文档
https://savannah.nongnu.org/projects/lwip/解决方案
-
增加 lwIP 的 TCP 段内存池:在 lwipopts.h 中设置 `#define MEMP_NUM_TCP_SEG 64` 和 `#define TCP_SND_BUF 4096`。
-
实现应用层保活机制,使用更短间隔(例如 5 秒)以尽早检测死连接。
-
使用 lwIP 回调 `tcp_err()` 处理连接重置并触发重连逻辑。
无效尝试
常见但无效的做法:
-
70% 失败
Increasing TCP timeout values delays failure but does not fix connectivity issue.
-
60% 失败
Disabling Nagle algorithm reduces latency but not retransmission due to packet loss.