From c4e67398590223467878dc481559c551c98a7f97 Mon Sep 17 00:00:00 2001
From: Matthieu Imbert <matthieu.imbert@inria.fr>
Date: Thu, 6 Jun 2024 09:35:26 +0200
Subject: [PATCH] [execo] conductor: fix eating 100% of one core iterating
 through high number of fd to close them

---
 src/execo/conductor.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/execo/conductor.py b/src/execo/conductor.py
index afa16e2..27af8f7 100644
--- a/src/execo/conductor.py
+++ b/src/execo/conductor.py
@@ -284,9 +284,7 @@ class _Conductor(object):
             maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
             if (maxfd == resource.RLIM_INFINITY):
                 maxfd = MAXFD
-            for fd in range(0, maxfd):
-                try: os.close(fd)
-                except OSError: pass
+            os.closerange(0, MAXFD)
             while True:
                 # poll each second that my parent is still alive. If
                 # not, die. Optionnaly kill all instanciated childs.
-- 
GitLab