# HG changeset patch # User Milka Kuzminski # Date 2020-12-30 08:57:15 # Node ID 279dbe3d2a89763cb97ae6403e392e251b0330ba # Parent a3afd4784a9d20d543a699123a72879a81d73ce4 vcsserver: use safer maxfd reporting, some linux systems get a problem with this diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -25,6 +25,7 @@ import wsgiref.util import traceback import tempfile import resource +import psutil from itertools import chain from cStringIO import StringIO @@ -117,14 +118,21 @@ def _string_setting(settings, name, defa return settings[name] +def log_max_fd(): + try: + maxfd = psutil.Process().rlimit(psutil.RLIMIT_NOFILE)[1] + log.info('Max file descriptors value: %s', maxfd) + except Exception: + pass + + class VCS(object): def __init__(self, locale_conf=None, cache_config=None): self.locale = locale_conf self.cache_config = cache_config self._configure_locale() - maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1] - log.info('Max file descriptors value: %s', maxfd) + log_max_fd() if GitFactory and GitRemote: git_factory = GitFactory()