{
  "id": "python/aiohttp-unexpected-close-connection",
  "signature": "aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer",
  "signature_zh": "aiohttp客户端操作系统错误：连接被对端重置",
  "regex": "aiohttp\\.client_exceptions\\.ClientOSError:\\ \\[Errno\\ 104\\]\\ Connection\\ reset\\ by\\ peer",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The remote server closed the TCP connection unexpectedly, often due to timeouts, server overload, or network issues.",
  "root_cause_type": "generic",
  "root_cause_zh": "远程服务器意外关闭了 TCP 连接，通常是由于超时、服务器过载或网络问题。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing the connector limit to allow more connections",
      "why_fails": "Connection reset is not related to pool size; it's a network-level issue.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disabling SSL verification",
      "why_fails": "SSL is not the cause; this does not address TCP resets.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Implement retry logic with exponential backoff",
      "success_rate": 0.85,
      "how": "for attempt in range(3): try: async with session.get(url) as resp: return await resp.text(); except ClientOSError: await asyncio.sleep(2**attempt)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase the TCP keepalive or use a longer timeout",
      "success_rate": 0.75,
      "how": "timeout = aiohttp.ClientTimeout(total=60); async with session.get(url, timeout=timeout) as resp: ...",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}