Python asyncio OSError 24 too many open files
In general operation systems set a limit to the number of open files per process. A “file” might be a regular file, a socket, a pipe, etc. When a Python program exceeds this limit, it raises exception:
OSError: [Errno 24] Too many open files
Such issues might tend to arise with highly concurrent applications as enabled by asyncio or higher-level libraries.
Resolving such asyncio concurrency issues generally involves asyncio
primitives
like
asyncio.Semaphore.
Implementing asyncio libraries correctly is so
non-trivial
that using higher-level libraries that implement such concurrency control
correctly
can be a better idea.
It’s important to go beyond toy examples and consider
real-world
concurrent Python usage patterns.