Skip to content

Commit

Permalink
Work around a file descriptor issue in cheroot.
Browse files Browse the repository at this point in the history
There is an issue that was introduced in 8.1.0 that throws an error when
file descriptor numbers are large (see
cherrypy/cheroot#249).  We can't pin cheroot
to an older version, as that breaks support for modern python versions.

It isn't clear if limiting the size of our cache will really help -- the
cheroot issue implies that it is leaking file descriptors, so this may
not do anything useful.
  • Loading branch information
manthey committed Jun 15, 2020
1 parent 1d8a1b3 commit 064258d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions large_image/cache_util/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
SoftNoFile, HardNoFile = resource.getrlimit(resource.RLIMIT_NOFILE)
resource.setrlimit(resource.RLIMIT_NOFILE, (HardNoFile, HardNoFile))
SoftNoFile, HardNoFile = resource.getrlimit(resource.RLIMIT_NOFILE)
# When run under cheroot, cheroot can fail if the file description is
# greater than 1024 (see github.com/cherrypy/cheroot/issues/249), so
# limit this further
SoftNoFile = min(SoftNoFile, 1024)
# Reserve some file handles for general use, and expect that tile
# sources could use many handles each. This is conservative, since
# running out of file handles breaks the program in general.
Expand Down

0 comments on commit 064258d

Please sign in to comment.