# asyncio.exceptions.TimeoutError: Connection timeout to host https://slow.example.com

- **ID:** `python/aiohttp-timeout-total`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The aiohttp ClientTimeout (total or sock_connect) elapsed before the server responded; default total is 5 minutes but sock_connect is only 30s.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Configure explicit timeouts:

timeout = aiohttp.ClientTimeout(total=30, connect=5, sock_read=10)
async with aiohttp.ClientSession(timeout=timeout) as s:
    await s.get(url)
   ```
2. **** (90% success)
   ```
   Wrap with asyncio.wait_for for a per-call ceiling:

await asyncio.wait_for(session.get(url), timeout=15)
   ```
3. **** (88% success)
   ```
   Use aiohttp-retry for exponential backoff on TimeoutError.
   ```

## Dead Ends

- **** — Requests hang forever on dead servers, exhausting the connection pool. (85% fail)
- **** — Masks slow endpoints but ties up sockets and worker slots. (60% fail)
- **** — Hammers an already-slow server and can trigger rate limits. (70% fail)
