[New-bugs-announce] [issue8713] multiprocessing needs option to eschew fork() under Linux

Brandon Craig Rhodes report at bugs.python.org
Fri May 14 18:13:11 CEST 2010


New submission from Brandon Craig Rhodes <brandon at rhodesmill.org>:

The "multiprocessing" module uses a bare fork() to create child processes under Linux, so the children get a copy of the entire state of the parent process.  But under Windows, child processes are freshly spun-up Python interpreters with none of the data structures or open connections of the parent process available.  This means that code that tests fine under Linux, because it is depending on residual parent state in a way that the programmer has not noticed, can fail spectacularly under Windows.

Therefore, the "multiprocessing" module should offer an option under Linux that ignores the advantage of being able to do a bare fork() and instead spins up a new interpreter instance just like Windows does.  Some developers will just use this for testing under Linux, so their test results are valid for Windows too; and some developers might even use this in production, preferring to give up a bit of efficiency under Linux in return for an application that will show the same behavior on both platforms.  Either way, an option that lets the developer subvert the simple "sys.platform != 'win32'" check in "forking.py" would go a long way towards helping us write platform-agnostic Python programs.

----------
components: Library (Lib)
messages: 105719
nosy: brandon-rhodes
priority: normal
severity: normal
status: open
title: multiprocessing needs option to eschew fork() under Linux
type: feature request
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8713>
_______________________________________


More information about the New-bugs-announce mailing list