Interview Prep/Python for DevOps/Concurrency, async, tests, services & containers

`OSError: [Errno 24] Too many open files` from an asyncio scanner with 20,000 targets.

IntermediateTroubleshootingConcurrency, async, tests, services & containers
Answer

Likely causes → All coroutines start at once and each opens a socket; no concurrency bound.

Diagnose → ulimit -n; count concurrent connections (ss -s).

Fix → Wrap each request in async with asyncio.Semaphore(200), and configure client connection limits (httpx.Limits(max_connections=200), aiohttp TCPConnector(limit=200)).

Prevent → Always bound concurrency explicitly; never gather an unbounded list of network calls.

All Python for DevOps questions Roadmap: Python for automation

More on Concurrency, async, tests, services & containers