PEP 446: Issues: add examples in other projects
This commit is contained in:
parent
4410f51ce3
commit
6196392414
41
pep-0446.txt
41
pep-0446.txt
|
@ -128,7 +128,7 @@ Most of the time, inheritable file descriptors "leaked" in child
|
|||
processes are not noticed, because they don't cause major bugs. It does
|
||||
not mean that these bugs must not be fixed.
|
||||
|
||||
Two examples of common issues with inherited file descriptors:
|
||||
Two common issues with inherited file descriptors:
|
||||
|
||||
* On Windows, a directory cannot be removed before all file handles open
|
||||
in the directory are closed. The same issue can be seen with files,
|
||||
|
@ -153,6 +153,30 @@ for example a way to escape from a chroot. With a leaked listening
|
|||
socket, a child process can accept new connections to read sensitive
|
||||
data.
|
||||
|
||||
Example of issues in open source projects:
|
||||
|
||||
* `Mozilla (Firefox) <https://bugzilla.mozilla.org/show_bug.cgi?id=147659>`_:
|
||||
open since 2002-05
|
||||
* `dbus library <https://bugs.freedesktop.org/show_bug.cgi?id=15947>`_:
|
||||
fixed in 2008-05 (`dbus commit
|
||||
<http://cgit.freedesktop.org/dbus/dbus/commit/?id=e2bc7232069b14b7299cb8b2eab436f60a232007>`_),
|
||||
close file descriptors in the child process
|
||||
* `autofs <https://bugzilla.redhat.com/show_bug.cgi?id=390591>`_:
|
||||
fixed in 2009-02, set the CLOEXEC flag
|
||||
* `qemu <https://bugzilla.redhat.com/show_bug.cgi?id=528134>`_:
|
||||
fixed in 2009-12 (`qemu commit
|
||||
<http://git.qemu.org/?p=qemu.git;a=commit;h=40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4>`_),
|
||||
set CLOEXEC flag
|
||||
* `Tor <https://trac.torproject.org/projects/tor/ticket/2029>`_:
|
||||
fixed in 2010-12, set CLOEXEC flag
|
||||
* `OCaml <http://caml.inria.fr/mantis/view.php?id=5256>`_: open since
|
||||
2011-04, "PR#5256: Processes opened using Unix.open_process* inherit
|
||||
all opened file descriptors (including sockets)"
|
||||
* `ØMQ <https://zeromq.jira.com/browse/LIBZMQ-408>`_:
|
||||
open since 2012-08
|
||||
* `Squid <https://bugzilla.redhat.com/show_bug.cgi?id=837033>`_:
|
||||
open since 2012-07
|
||||
|
||||
|
||||
Issues fixed in the subprocess module
|
||||
-------------------------------------
|
||||
|
@ -327,8 +351,13 @@ On Linux, Python 3.3 gets the list of all open file descriptors from
|
|||
``/proc/<PID>/fd/``, and so performances depends on the number of open
|
||||
file descriptors, not on MAXFD.
|
||||
|
||||
See also the `issue #1663329: subprocess close_fds perform poor if
|
||||
SC_OPEN_MAX is high <http://bugs.python.org/issue1663329>`_.
|
||||
See also:
|
||||
|
||||
* `Python issue #1663329 <http://bugs.python.org/issue1663329>`_:
|
||||
subprocess close_fds perform poor if ``SC_OPEN_MAX`` is high
|
||||
* `Squid Bug #837033 <https://bugzilla.redhat.com/show_bug.cgi?id=837033>`_:
|
||||
Squid should set CLOEXEC on opened FDs. "32k+ close() calls in each
|
||||
child process take a long time ([12-56] seconds) in Xen PV guests."
|
||||
|
||||
|
||||
Proposal
|
||||
|
@ -425,8 +454,8 @@ The programming languages Go, Perl and Ruby make newly created file
|
|||
descriptors non-inheritable by default: since Go 1.0 (2009), Perl 1.0
|
||||
(1987) and Ruby 2.0 (2013).
|
||||
|
||||
The SCons project overrides builtin functions ``file()`` and ``open()``
|
||||
to make files non-inheritable on Windows:
|
||||
The SCons project, written in Python, overrides builtin functions
|
||||
``file()`` and ``open()`` to make files non-inheritable on Windows:
|
||||
see `win32.py
|
||||
<https://bitbucket.org/scons/scons/src/c8dbbaa4598e7119ae80f72068386be105b5ad98/src/engine/SCons/Platform/win32.py?at=default#cl-68>`_.
|
||||
|
||||
|
@ -508,6 +537,8 @@ Other links:
|
|||
* `Ghosts of Unix past, part 2: Conflated designs
|
||||
<http://lwn.net/Articles/412131/>`_ (Neil Brown, 2010) explains the
|
||||
history of ``O_CLOEXEC`` and ``O_NONBLOCK`` flags
|
||||
* `File descriptor handling changes in 2.6.27
|
||||
<http://lwn.net/Articles/292843/>`_
|
||||
|
||||
|
||||
Copyright
|
||||
|
|
Loading…
Reference in New Issue