{
  "id": "python/aiohttp-too-many-open-files",
  "signature": "OSError: [Errno 24] Too many open files",
  "signature_zh": "OSError: [Errno 24] 打开的文件过多",
  "regex": "OSError:\\ \\[Errno\\ 24\\]\\ Too\\ many\\ open\\ files",
  "domain": "python",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "aiohttp ClientSession leaked connections or was created per request without closing, exhausting the process file descriptor limit.",
  "root_cause_type": "generic",
  "root_cause_zh": "aiohttp ClientSession 泄漏连接，或每个请求都创建且未关闭，耗尽了进程文件描述符上限。",
  "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"
    },
    {
      "version": "3.11+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Delays the failure but the leak continues; process eventually hits the new limit.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Sessions hold OS resources until explicitly closed; GC does not close sockets.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "connector = aiohttp.TCPConnector(limit=100, limit_per_host=20)\nasync with aiohttp.ClientSession(connector=connector) as session:\n    await run_all(session)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.93,
      "how": "async with session.get(url) as resp:\n    data = await resp.read()  # response released on exit",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-11",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}