{
  "id": "embedded/lwip-tcp-connection-reset-during-handshake",
  "signature": "lwIP: TCP connection reset by peer during SYN-SENT state, remote port 8080",
  "signature_zh": "lwIP：TCP 连接在 SYN-SENT 状态下被对端重置，远程端口 8080",
  "regex": "lwIP: TCP connection reset by peer during SYN-SENT state, remote port \\d+",
  "domain": "embedded",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "Remote host sends RST packet during TCP handshake due to firewall rules, port closed, or mismatched TCP window scale options.",
  "root_cause_type": "generic",
  "root_cause_zh": "远程主机在 TCP 握手期间发送 RST 包，原因包括防火墙规则、端口关闭或 TCP 窗口缩放选项不匹配。",
  "versions": [
    {
      "version": "lwIP 2.1.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "FreeRTOS+TCP 2.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ESP-IDF 5.1.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase TCP SYN timeout in lwIPopts.h (e.g., TCP_SYNMAXRTX = 12)",
      "why_fails": "Timeout increase does not prevent RST; RST is sent by remote host immediately, not a local timeout issue.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable TCP window scaling by setting TCP_WND to small value",
      "why_fails": "Window scaling mismatch is rarely the cause; disabling it may degrade performance without fixing the RST.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify remote port is open using a separate tool (e.g., telnet or nmap from host PC). If port is closed, reconfigure server or firewall rules. For embedded device, add retry logic with exponential backoff in application code.",
      "success_rate": 0.85,
      "how": "Verify remote port is open using a separate tool (e.g., telnet or nmap from host PC). If port is closed, reconfigure server or firewall rules. For embedded device, add retry logic with exponential backoff in application code.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Enable lwIP debug output for TCP events: set LWIP_DBG_ON in lwipopts.h and call tcp_debug_print(TCP_EVENT_CONNECT) to capture RST packet details, then adjust TCP_MSS or TCP_SND_BUF to match server expectations.",
      "success_rate": 0.7,
      "how": "Enable lwIP debug output for TCP events: set LWIP_DBG_ON in lwipopts.h and call tcp_debug_print(TCP_EVENT_CONNECT) to capture RST packet details, then adjust TCP_MSS or TCP_SND_BUF to match server expectations.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Verify remote port is open using a separate tool (e.g., telnet or nmap from host PC). If port is closed, reconfigure server or firewall rules. For embedded device, add retry logic with exponential backoff in application code.",
    "Enable lwIP debug output for TCP events: set LWIP_DBG_ON in lwipopts.h and call tcp_debug_print(TCP_EVENT_CONNECT) to capture RST packet details, then adjust TCP_MSS or TCP_SND_BUF to match server expectations."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.nongnu.org/lwip/2_1_x/tcp.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2024-08-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}