# aiohttp.client_exceptions.ClientConnectionError: Cannot connect to host example.com:443 ssl:default [Connection refused]

- **ID:** `python/aiohttp-client-connection-pool-exhausted`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The connection pool limit is reached or the server refuses connections due to too many simultaneous requests, often because ClientSession's connector limit is too low or connections are not released.

## Version Compatibility

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

## Workarounds

1. **** (85% success)
   ```
   connector = aiohttp.TCPConnector(limit=100, limit_per_host=20)
async with aiohttp.ClientSession(connector=connector) as session:
    # use session for multiple requests
   ```
2. **** (90% success)
   ```
   for attempt in range(3):
    try:
        async with session.get(url) as resp:
            return await resp.text()
    except aiohttp.ClientConnectionError:
        if attempt == 2:
            raise
        await asyncio.sleep(2 ** attempt)
   ```

## Dead Ends

- **** — Higher limit can lead to resource exhaustion and doesn't address server-side refusal. (50% fail)
- **** — Creates many sessions, each with its own pool, causing overhead and still hitting OS limits. (70% fail)
