Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2017 13:25:51 +0000
From:      bugzilla-noreply@freebsd.org
To:        python@FreeBSD.org
Subject:   [Bug 221700] lang/python: subprocess does not use closefrom, calls close(2) hundreds of thousands of times
Message-ID:  <bug-221700-21822-89iy38siyx@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-221700-21822@https.bugs.freebsd.org/bugzilla/>
References:  <bug-221700-21822@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221700

--- Comment #2 from Ed Maste <emaste@freebsd.org> ---
A minimum viable patch to address this:

diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
index 8c8777cfe3..d390ec8ee6 100644
--- a/Modules/_posixsubprocess.c
+++ b/Modules/_posixsubprocess.c
@@ -232,9 +232,13 @@ _close_fds_by_brute_force(long start_fd, PyObject
*py_fds_to_keep)
         start_fd =3D keep_fd + 1;
     }
     if (start_fd <=3D end_fd) {
+#if defined(__FreeBSD__)
+        closefrom(start_fd);
+#else
         for (fd_num =3D start_fd; fd_num < end_fd; ++fd_num) {
             close(fd_num);
         }
+#endif
     }
 }

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221700-21822-89iy38siyx>