summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-09-07 16:45:55 +0100
committerMark Haines <mark.haines@matrix.org>2015-09-07 16:45:55 +0100
commit709ba99afda371bb19a34e4448dc771a6cdab320 (patch)
treedbcfad5cb9fedb7a530b155ccd15ec9cac4e3ad1 /synapse
parentThe maxrss reported by getrusage is in kilobytes, not pages (diff)
downloadsynapse-709ba99afda371bb19a34e4448dc771a6cdab320.tar.xz
Check that /proc/self/fd exists before listing it
Diffstat (limited to 'synapse')
-rw-r--r--synapse/metrics/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index 3f7b7158aa..943d637459 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -130,6 +130,10 @@ def _process_fds():
     counts = {(k,): 0 for k in TYPES.values()}
     counts[("other",)] = 0
 
+    # Not every OS will have a /proc/self/fd directory
+    if not os.path.exists("/proc/self/fd"):
+        return counts
+
     for fd in os.listdir("/proc/self/fd"):
         try:
             s = os.stat("/proc/self/fd/%s" % (fd))