Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Using psutil to investigate “Too many open files”#
I was getting this intermittent error running my Datasette test suite:
1OSError: [Errno 24] Too many open filesTo figure out what was going on, I used the psutil package and its open_files() method.
Here’s the documentation for psutil.Process.open_files.
I ran pip install psutil in my virtual environment.
Then I ran pytest --pdb to drop into a Python debugger when a test failed.
In the debugger I ran this:
1import psutil2for f in psutil.Process().open_files(): print(f)This showed the current list of open files for that process, which gave me some clues to help me start resolving the problem.
Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.