-
-
Notifications
You must be signed in to change notification settings - Fork 813
Closed
Description
I got this on my laptop:
...
/Users/simon/.local/share/virtualenvs/datasette-AWNrQs95/lib/python3.7/site-packages/jinja2/loaders.py:171: in get_source
f = open_if_exists(filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/Users/simon/Dropbox/Development/datasette/datasette/templates/400.html', mode = 'rb'
def open_if_exists(filename, mode='rb'):
"""Returns a file descriptor for the filename if that file exists,
otherwise `None`.
"""
try:
> return open(filename, mode)
E OSError: [Errno 24] Too many open files: '/Users/simon/Dropbox/Development/datasette/datasette/templates/400.html'
/Users/simon/.local/share/virtualenvs/datasette-AWNrQs95/lib/python3.7/site-packages/jinja2/utils.py:154: OSError
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 call conn.close() on those opened connections:
datasette/datasette/database.py
Lines 58 to 60 in cf7a2bd
| return sqlite3.connect( | |
| "file:{}{}".format(self.path, qs), uri=True, check_same_thread=False | |
| ) |
Could this be resulting in my tests eventually opening too many unclosed file handles? How could I confirm this?
Reactions are currently unavailable