{
  "id": "go/http-response-body-not-closed-leak",
  "signature": "error: http: server closed idle connection (client error: EOF)",
  "signature_zh": "错误：http：服务器关闭空闲连接（客户端错误：文件结束）",
  "regex": "error:\\ http:\\ server\\ closed\\ idle\\ connection\\ \\(client\\ error:\\ EOF\\)",
  "domain": "go",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "HTTP响应体未关闭，导致连接无法复用，服务器因空闲超时关闭连接，客户端在读取时遇到EOF。",
  "root_cause_type": "generic",
  "root_cause_zh": "HTTP响应体未被关闭，连接无法复用，服务器因空闲超时关闭连接，客户端读取时遇到EOF错误。",
  "versions": [
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "不关闭响应体会导致连接泄漏，最终耗尽连接池。",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "未读取的响应体可能阻止连接复用，导致性能下降。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "defer resp.Body.Close()\nio.Copy(io.Discard, resp.Body) // 确保读取完所有内容",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "使用io.ReadAll或json.Decoder时确保正确关闭响应体。",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}