# OSError: [Errno 24] Too many open files

- **ID:** `python/aiohttp-too-many-open-files`
- **Domain:** python
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

aiohttp ClientSession leaked connections or was created per request without closing, exhausting the process file descriptor limit.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   connector = aiohttp.TCPConnector(limit=100, limit_per_host=20)
async with aiohttp.ClientSession(connector=connector) as session:
    await run_all(session)
   ```
2. **** (93% success)
   ```
   async with session.get(url) as resp:
    data = await resp.read()  # response released on exit
   ```

## Dead Ends

- **** — Delays the failure but the leak continues; process eventually hits the new limit. (70% fail)
- **** — Sessions hold OS resources until explicitly closed; GC does not close sockets. (85% fail)
