summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/reduction.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-97514: Authenticate the forkserver control socket. (GH-99309)Gregory P. Smith2024-11-201-6/+6
| | | | | | | | | | | | | | | | | | | This adds authentication to the forkserver control socket. In the past only filesystem permissions protected this socket from code injection into the forkserver process by limiting access to the same UID, which didn't exist when Linux abstract namespace sockets were used (see issue) meaning that any process in the same system network namespace could inject code. We've since stopped using abstract namespace sockets by default, but protecting our control sockets regardless of type is a good idea. This reuses the HMAC based shared key auth already used by `multiprocessing.connection` sockets for other purposes. Doing this is useful so that filesystem permissions are not relied upon and trust isn't implied by default between all processes running as the same UID with access to the unix socket. ### pyperformance benchmarks No significant changes. Including `concurrent_imap` which exercises `multiprocessing.Pool.imap` in that suite. ### Microbenchmarks This does _slightly_ slow down forkserver use. How much so appears to depend on the platform. Modern platforms and simple platforms are less impacted. This PR adds additional IPC round trips to the control socket to tell forkserver to spawn a new process. Systems with potentially high latency IPC are naturally impacted more. Typically a 1-4% slowdown on a very targeted process creation microbenchmark, with a worst case overloaded system slowdown of 20%. No evidence that these slowdowns appear in practical sense. See the PR for details.
* bpo-34521: Fix tests in test_multiprocessing_spawn to use correctly ↵Pablo Galindo2018-09-281-1/+1
| | | | | | | | | | | | | | | | CMSG_SPACE (GH-9613) After some failures in AMD64 FreeBSD CURRENT Debug 3.x buildbots regarding tests in test_multiprocessing_spawn and after examining similar failures in test_socket, some errors in the calculation of ancillary data buffers were found in multiprocessing.reduction. CMSG_LEN() can often be used as the buffer size for recvmsg() to receive a single item of ancillary data, but RFC 3542 requires portable applications to use CMSG_SPACE() and thus include space for padding, even when the item will be the last in the buffer. The failures we experience are due to the usage of CMSG_LEN() instead of CMSG_SPACE().
* bpo-33929: multiprocessing: fix handle leak on race condition (GH-7921)Victor Stinner2018-06-271-3/+7
| | | | | | | | | Fix a race condition in Popen of multiprocessing.popen_spawn_win32. The child process now duplicates the read end of pipe instead of "stealing" it. Previously, the read end of pipe was "stolen" by the child process, but it leaked a handle if the child process had been terminated before it could steal the handle from the parent process.
* bpo-5001: More-informative multiprocessing error messages (#3079)Allen W. Smith, Ph.D2017-08-291-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make error message more informative Replace assertions in error-reporting code with more-informative version that doesn't cause confusion over where and what the error is. * Additional clarification + get travis to check * Change from SystemError to TypeError As suggested in PR comment by @pitrou, changing from SystemError; TypeError appears appropriate. * NEWS file installation; ACKS addition (will do my best to justify it by additional work) * Making current AssertionErrors in multiprocessing more informative * Blurb added re multiprocessing managers.py, queues.py cleanup * Further multiprocessing cleanup - went through pool.py * Fix two asserts in multiprocessing/util.py * Most asserts in multiprocessing more informative * Didn't save right version * Further work on multiprocessing error messages * Correct typo * Correct typo v2 * Blasted colon... serves me right for trying to work on two things at once * Simplify NEWS entry * Update 2017-08-18-17-16-38.bpo-5001.gwnthq.rst * Update 2017-08-18-17-16-38.bpo-5001.gwnthq.rst OK, never mind. * Corrected (thanks to pitrou) error messages for notify * Remove extraneous backslash in docstring.
* bpo-29919: Remove unused imports found by pyflakes (#137)Victor Stinner2017-03-271-1/+1
| | | Make also minor PEP8 coding style fixes on modified imports.
* Issue #28053: Applying refactorings, docs and other cleanup to follow.Davin Potts2016-09-091-0/+34
|
* Issue #20976: pyflakes: Remove unused importsVictor Stinner2014-03-201-1/+0
|
* Issue #18999: Make multiprocessing use context objects.Richard Oudkerk2013-10-161-2/+2
| | | | | This allows different parts of a program to use different methods for starting processes without interfering with each other.
* Issue #8713: Support alternative start methods in multiprocessing on Unix.Richard Oudkerk2013-08-141-201/+162
| | | | See http://hg.python.org/sandbox/sbt#spawn
* Issue #14669: Fix pickling of connections and sockets on MacOSXRichard Oudkerk2012-08-161-0/+8
| | | | | by sending/receiving an acknowledgment after file descriptor transfer. TestPicklingConnection has been reenabled for MacOSX.
* Mark multiprocessing files with "Licensed to PSF under a Contributor Agreement"Richard Oudkerk2012-04-301-26/+1
| | | | instead of BSD licence.
* Issue #14666: stop multiprocessing's resource-sharing thread after the tests ↵Antoine Pitrou2012-04-271-1/+28
| | | | | | | | are done. Also, block delivery of signals to that thread. Patch by Richard Oudkerk. This will hopefully fix sporadic freezes on the FreeBSD 9.0 buildbot.
* Issue #4892: multiprocessing Connections can now be transferred over ↵Antoine Pitrou2012-04-241-137/+178
| | | | | | multiprocessing Connections. Patch by Richard Oudkerk (sbt).
* Issue #11750: The Windows API functions scattered in the _subprocess andAntoine Pitrou2012-04-181-3/+3
| | | | | _multiprocessing.win32 modules now live in a single module "_winapi". Patch by sbt.
* Remove unused or redundant imports in concurrent.futures and multiprocessing.Florent Xicluna2011-11-111-2/+0
|
* Issue #12981: rewrite multiprocessing_{sendfd,recvfd} in Python.Charles-François Natali2011-09-241-3/+18
|
* Issue #11743: Rewrite multiprocessing connection classes in pure Python.Antoine Pitrou2011-05-091-6/+7
|
* 9162: fix license in multiprocessing filesR. David Murray2010-12-141-1/+27
|
* Fix #9513 to remove relative imports from multiprocessing.Brian Curtin2010-08-041-1/+1
| | | | | | | The test suite currently skips test_multiprocessing on Windows because it fails on finding _multiprocessing in several win32-specific blocks. Removing the relative import lets this through and allows the test to run (and pass).
* Issue #3125: Remove copy_reg in multiprocessing and replace it withAmaury Forgeot d'Arc2008-08-191-8/+7
| | | | ForkingPickler.register() to resolve conflict with ctypes.
* Merged revisions 65864 via svnmerge fromBenjamin Peterson2008-08-191-3/+3
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r65864 | jesse.noller | 2008-08-19 14:06:19 -0500 (Tue, 19 Aug 2008) | 2 lines issue3352: clean up the multiprocessing API to remove many get_/set_ methods and convert them to properties. Update the docs and the examples included. ........
* Merged revisions 64125 via svnmerge fromBenjamin Peterson2008-06-111-1/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r64125 | benjamin.peterson | 2008-06-11 12:27:50 -0500 (Wed, 11 Jun 2008) | 2 lines give the threading API PEP 8 names ........
* Merged revisions 64104,64117 via svnmerge fromBenjamin Peterson2008-06-111-0/+190
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64104 | benjamin.peterson | 2008-06-10 21:40:25 -0500 (Tue, 10 Jun 2008) | 2 lines add the multiprocessing package to fulfill PEP 371 ........ r64117 | benjamin.peterson | 2008-06-11 07:26:31 -0500 (Wed, 11 Jun 2008) | 2 lines fix import of multiprocessing by juggling imports ........