{
  "id": "go/http-connection-reset-by-peer",
  "signature": "error: read tcp 192.168.1.10:8080->192.168.1.20:5432: read: connection reset by peer",
  "signature_zh": "错误：读取TCP连接192.168.1.10:8080->192.168.1.20:5432时，对端重置连接",
  "regex": "error:\\ read\\ tcp\\ 192\\.168\\.1\\.10:8080\\->192\\.168\\.1\\.20:5432:\\ read:\\ connection\\ reset\\ by\\ peer",
  "domain": "go",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "对端服务器主动关闭了TCP连接，可能因超时、崩溃或防火墙干预。",
  "root_cause_type": "generic",
  "root_cause_zh": "对端服务器主动关闭了TCP连接，可能因超时、崩溃或防火墙干预。",
  "versions": [
    {
      "version": "1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "连接已无效，后续读写会失败。",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "keepalive不能防止对端重置，只能检测死连接。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.75,
      "how": "实现连接池和重连逻辑：\nfor {\n    resp, err := client.Get(url)\n    if err != nil {\n        // 重新创建连接\n        client.CloseIdleConnections()\n        continue\n    }\n    break\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "设置合理的超时和重试：\nclient := &http.Client{Timeout: 10 * time.Second}\nfor i := 0; i < 3; i++ {\n    resp, err := client.Get(url)\n    if err == nil { break }\n    time.Sleep(2 * time.Second)\n}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}