# TimeoutError: 处理并发请求时，读取操作超时（30 秒后）。

- **ID:** `python/fastapi-async-def-blocking-call`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

`async def` 端点中的阻塞调用（如 `requests.get`、`time.sleep`、同步数据库驱动）阻塞了事件循环，导致其他请求饥饿。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 0.100+ | active | — | — |

## 解决方案

1. **** (93% 成功率)
   ```
   from fastapi.concurrency import run_in_threadpool
result = await run_in_threadpool(requests.get, url)
   ```
2. **** (95% 成功率)
   ```
   async with httpx.AsyncClient() as c:
    r = await c.get(url)
   ```

## 无效尝试

- **** — Delays symptom; event loop still blocked. (75% 失败率)
- **** — Each worker still blocks on the same call. (70% 失败率)
