{
  "id": "python/fastapi-db-session-not-closed",
  "signature": "sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30.00",
  "signature_zh": "sqlalchemy.exc.TimeoutError: QueuePool 大小 5、溢出 10 已达上限，连接超时 30.00 秒。",
  "regex": "sqlalchemy\\.exc\\.TimeoutError:\\ QueuePool\\ limit\\ of\\ size\\ 5\\ overflow\\ 10\\ reached,\\ connection\\ timed\\ out,\\ timeout\\ 30\\.00",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Dependency yields a DB session but never closes it on exceptions, leaking connections until the pool is exhausted.",
  "root_cause_type": "generic",
  "root_cause_zh": "依赖项 yield 了数据库会话但异常时未关闭，连接泄漏直至连接池耗尽。",
  "versions": [
    {
      "version": "0.100+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Delays exhaustion; underlying leak persists.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Detects dead connections, does not free leaked ones.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.97,
      "how": "def get_db():\n    db = SessionLocal()\n    try:\n        yield db\n    finally:\n        db.close()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.96,
      "how": "def get_db():\n    with SessionLocal() as db:\n        yield db",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-17",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}