Merge branch '20529-container-deadlocks' refs #20529
[arvados.git] / services / fuse / arvados_fuse / command.py
index 8cb0a0601b39044f4e8e3cd2c3118da5e055580f..95b9a9773b044c8f4d5ba8e7a952747554822cc9 100644 (file)
@@ -16,6 +16,7 @@ import signal
 import subprocess
 import sys
 import time
+import resource
 
 import arvados.commands._util as arv_cmd
 from arvados_fuse import crunchstat
@@ -133,6 +134,15 @@ class Mount(object):
         if self.args.logfile:
             self.args.logfile = os.path.realpath(self.args.logfile)
 
+        try:
+            nofile_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
+            if nofile_limit[0] < 10240:
+                resource.setrlimit(resource.RLIMIT_NOFILE, (min(10240, nofile_limit[1]), nofile_limit[1]))
+        except Exception as e:
+            self.logger.warning("arv-mount: unable to adjust file handle limit: %s", e)
+
+        self.logger.debug("arv-mount: file handle limit is %s", resource.getrlimit(resource.RLIMIT_NOFILE))
+
         try:
             self._setup_logging()
             self._setup_api()
@@ -220,6 +230,9 @@ class Mount(object):
         try:
             self.api = arvados.safeapi.ThreadSafeApiCache(
                 apiconfig=arvados.config.settings(),
+                api_params={
+                    'num_retries': self.args.retries,
+                },
                 # default value of file_cache is 0, this tells KeepBlockCache to
                 # choose a default based on whether disk_cache is enabled or not.
                 keep_params={