[Bug 221700] lang/python: subprocess does not use closefrom, calls close(2) hundreds of thousands of times
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Aug 22 15:08:13 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221700
Conrad Meyer <cem at freebsd.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cem at freebsd.org
--- Comment #3 from Conrad Meyer <cem at freebsd.org> ---
You might also consider closefrom() in posix_closerange() of
Modules/posixmodule.c:
--- ./Modules/posixmodule.c 2015-05-23 09:09:20.000000000 -0700
+++ ./Modules/posixmodule.c 2015-07-17 15:00:38.784909475 -0700
@@ -6668,9 +6668,12 @@
if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to))
return NULL;
Py_BEGIN_ALLOW_THREADS
- for (i = fd_from; i < fd_to; i++)
- if (_PyVerify_fd(i))
- close(i);
+ if (fd_to >= sysconf(_SC_OPEN_MAX)) {
+ closefrom(fd_from);
+ } else
+ for (i = fd_from; i < fd_to; i++)
+ if (_PyVerify_fd(i))
+ close(i);
Py_END_ALLOW_THREADS
Py_RETURN_NONE;
}
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-python
mailing list