{
  "id": "python/fastapi-async-def-blocking-call",
  "signature": "TimeoutError: The read operation timed out (after 30s) while handling concurrent requests",
  "signature_zh": "TimeoutError: 处理并发请求时，读取操作超时（30 秒后）。",
  "regex": "TimeoutError:\\ The\\ read\\ operation\\ timed\\ out\\ \\(after\\ 30s\\)\\ while\\ handling\\ concurrent\\ requests",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A blocking call (e.g., `requests.get`, `time.sleep`, synchronous DB driver) inside an `async def` endpoint blocks the event loop, starving other requests.",
  "root_cause_type": "generic",
  "root_cause_zh": "`async def` 端点中的阻塞调用（如 `requests.get`、`time.sleep`、同步数据库驱动）阻塞了事件循环，导致其他请求饥饿。",
  "versions": [
    {
      "version": "0.100+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Delays symptom; event loop still blocked.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Each worker still blocks on the same call.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.93,
      "how": "from fastapi.concurrency import run_in_threadpool\nresult = await run_in_threadpool(requests.get, url)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "async with httpx.AsyncClient() as c:\n    r = await c.get(url)",
      "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-08-21",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}