-
-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Too many open files" error running tests #846
Comments
This shows currently open files (after
I ran it inside
So yeah, that's too many open files! |
That's 91 open files but only 29 unique filenames. |
I tried this experiment: import sqlite3, psutil
def show_things():
conn = sqlite3.connect("fixtures.db")
tables = [r[0] for r in conn.execute("select * from sqlite_master").fetchall()]
return tables
print(psutil.Process().open_files())
print(show_things())
print(psutil.Process().open_files()) To see if the connection would be automatically released when the Likewise:
So presumably there's something about the way my pytest fixtures work that's causing the many different |
Released a new plugin, |
Idea: |
That seems to have fixed the problem, at least for the moment. |
I got this on my laptop:
Based on the conversation in pytest-dev/pytest#2970 I'm worried that my tests are opening too many files without closing them.
In particular... I call
sqlite3.connect(filepath)
a LOT - and I don't ever callconn.close()
on those opened connections:datasette/datasette/database.py
Lines 58 to 60 in cf7a2bd
Could this be resulting in my tests eventually opening too many unclosed file handles? How could I confirm this?
The text was updated successfully, but these errors were encountered: