# lwIP: TCP connection lost, too many duplicate ACKs triggered retransmit timeout on socket 3

- **ID:** `embedded/lwip-tcp-dup-ack-retransmit`
- **Domain:** embedded
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

Persistent packet loss due to network congestion or faulty PHY, causing lwIP TCP to enter retransmission timeout and close the connection.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| lwIP v2.1.3 | active | — | — |
| FreeRTOS+TCP v3.1.0 | active | — | — |
| STM32F769 | active | — | — |

## Workarounds

1. **Enable lwIP TCP keepalive to detect stale connections early and implement application-level retry logic.** (80% success)
   ```
   Enable lwIP TCP keepalive to detect stale connections early and implement application-level retry logic.
   ```
2. **Improve PHY stability by adding external pull-up resistors on TX and RX lines and verifying MDC/MDIO timing per datasheet.** (70% success)
   ```
   Improve PHY stability by adding external pull-up resistors on TX and RX lines and verifying MDC/MDIO timing per datasheet.
   ```

## Dead Ends

- **Increase TCP retransmission timeout in lwIP config (TCP_RTO_MIN)** — Delays detection of genuine connection loss and may cause application-level timeouts; does not fix underlying packet loss. (65% fail)
- **Disable TCP Nagle algorithm to send smaller packets** — Reduces throughput and may increase ACK overhead; does not address duplicate ACK cause. (70% fail)
- **Replace PHY chip with a different model** — Expensive and time-consuming; the issue may be due to PCB layout or driver configuration, not the PHY itself. (50% fail)
