Closed tristaneljed closed 6 years ago
This is likely to do with your app or some other package, timezonefinder
doesn't open that many files. In unix, every process has a limit on the number of files it can open. You might be opening files and not closing them?
Not really, it's a simple flask API. I'll investigate more into the code of timezonefinder
and see the cause of the issue.
If you use open
not as a context manager, i.e. foo = open('filename')
, that creates a new file handle. Unless foo
gets garbage collected, or foo.close()
is called, the file handle will remain open.
If you run strace python myapp.py
you will see all the calls to open
, that might help debug what's opening so many files.
FYI: at the moment the TimezoneFinder class keeps 14 files open until it gets deleted (the del function is being called). This is intended behavior.
I am using this library within my python app hosted in a docker image, and when I started using it it was okay, and now I'm having this issue. My guess is that somewhere in the code the object is not being garbage collected/destroyed and the binaries remain open over time causing the issue. Any inputs?