python.http_blocking_async
Performance
High
Detects blocking HTTP calls in async code.
Why It Matters
Section titled “Why It Matters”Blocking HTTP in async:
- Event loop blocked — All other tasks stall
- Concurrency destroyed — Async benefits lost
- Timeout cascades — Other coroutines time out
Example
Section titled “Example”# ❌ Before (blocking call in async)import requests
async def fetch_data(): response = requests.get(url) # Blocks event loop! return response.json()# ✅ After (async HTTP client)import httpx
async def fetch_data(): async with httpx.AsyncClient() as client: response = await client.get(url) return response.json()What Unfault Detects
Section titled “What Unfault Detects”- requests.get/post in async functions
- urllib calls in async context
- Sync HTTP clients in coroutines