summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
Commit message (Collapse)AuthorAgeFilesLines
* [3.8] bpo-40330: Fix utf-8 size check in ShareableList (GH-19606) (GH-19625)Antoine Pitrou2020-04-201-4/+6
| | | | | | | | The item size must be checked after encoding to bytes, not before. Automerge-Triggered-By: @pitrou. (cherry picked from commit eba9f6155df59c9beed97fb5764c9f01dd941af0) Co-authored-by: Antoine Pitrou <antoine@python.org>
* Fix two typos in multiprocessing (GH-19571) (GH-19578)Miss Islington (bot)2020-04-181-2/+2
| | | | | | | (cherry picked from commit c606624af8d4cb3b4a052fb263bb983b3f87585b) Co-authored-by: Galden <wudenggang0@163.com> Co-authored-by: Galden <wudenggang0@163.com>
* bpo-39360: Ensure all workers exit when finalizing a multiprocessing Pool ↵Miss Islington (bot)2020-03-151-2/+5
| | | | | | | | | | | | (GH-19009) When the pull is not used via the context manager or terminate() is called, there is a system in multiprocessing.util that handles finalization of all pools via an atexit handler (the Finalize) class. This class registers the _terminate_pool handler in the registry of finalizers of the module, and that registry is called on interpreter exit via _exit_function. The problem is that the "happy" path with the context manager or manual call to finalize() does some extra steps that _terminate_pool does not. The step that is not executed when the atexit() handler calls _terminate_pool is pinging the _change_notifier queue to unblock the maintenance threads. This commit moves the notification to the _terminate_pool function so is called from both code paths. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit ac10e0c93218627d1a639db0b7b41714c5f6a883) Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
* [3.8] bpo-39850: Add support for abstract sockets in multiprocessing ↵Pablo Galindo2020-03-094-5/+35
| | | | | (GH-18866) (GH-18876) (cherry picked from commit 6012f30beff7fa8396718dfb198ccafc333c565b)
* bpo-39439: Fix multiprocessing spawn path in a venv on Windows (GH-18158)Miss Islington (bot)2020-01-281-1/+1
| | | | | (cherry picked from commit 0be3246d4f9c8eddcd55491901d95b09fe163f15) Co-authored-by: Adam Meily <ameily@users.noreply.github.com>
* bpo-38546: multiprocessing tests stop the resource tracker (GH-17641) (GH-17647)Victor Stinner2019-12-182-0/+38
| | | | | | | | | | | | Multiprocessing and concurrent.futures tests now stop the resource tracker process when tests complete. Add ResourceTracker._stop() method to multiprocessing.resource_tracker. Add _cleanup_tests() helper function to multiprocessing.util: share code between multiprocessing and concurrent.futures tests. (cherry picked from commit 9707e8e22d80ca97bf7a9812816701cecde6d226)
* bpo-38707: Fix for multiprocessing.Process MainThread.native_id (GH-17088)Miss Islington (bot)2019-11-191-0/+2
| | | | | | | | | | | | | | | | This PR implements a fix for `multiprocessing.Process` objects; the error occurs when Processes are created using either `fork` or `forkserver` as the `start_method`. In these instances, the `MainThread` of the newly created `Process` object retains all attributes from its parent's `MainThread` object, including the `native_id` attribute. The resulting behavior is such that the new process' `MainThread` captures an incorrect/outdated `native_id` (the parent's instead of its own). This change forces the Process object to update its `native_id` attribute during the bootstrap process. cc @vstinner https://bugs.python.org/issue38707 Automerge-Triggered-By: @pitrou (cherry picked from commit c6b20be85c0de6f2355c67ae6e7e578941275cc0) Co-authored-by: Jake Tesler <jake.tesler@gmail.com>
* bpo-38092: Reduce overhead when using multiprocessing in a Windows virtual ↵Miss Islington (bot)2019-09-132-2/+2
| | | | | | | | environment (GH-16098) https://bugs.python.org/issue38092 (cherry picked from commit f2b7556ef851ac85e7cbf189d1b29fdeb9539b88) Co-authored-by: Steve Dower <steve.dower@python.org>
* Fix typos mostly in comments, docs and test names (GH-15209)Miss Islington (bot)2019-08-301-1/+1
| | | | | (cherry picked from commit 39d87b54715197ca9dcb6902bb43461c0ed701a2) Co-authored-by: Min ho Kim <minho42@gmail.com>
* bpo-37421: multiprocessing tests now stop ForkServer (GH-14601)Miss Islington (bot)2019-07-051-0/+19
| | | | | | | | multiprocessing tests now stop the ForkServer instance if it's running: close the "alive" file descriptor to ask the server to stop and then remove its UNIX address. (cherry picked from commit 8fbeb14312b4c1320d31ad86e69749515879d1c3) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37421: Fix multiprocessing get_temp_dir() finalizer (GH-14572)Miss Islington (bot)2019-07-041-1/+13
| | | | | | | | | Fix multiprocessing.util.get_temp_dir() finalizer: clear also the 'tempdir' configuration of the current process, so next call to get_temp_dir() will create a new temporary directory, rather than reusing the removed temporary directory. (cherry picked from commit 9d40554e0da09a44a8547f3f3a2b9dedfeaf7928) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37369: Fix initialization of sys members when launched via an app ↵Steve Dower2019-06-291-2/+1
| | | | | | container (GH-14467) sys._base_executable is now always defined on all platforms, and can be overridden through configuration. Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
* bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)Serhiy Storchaka2019-06-013-9/+6
|
* bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603)Victor Stinner2019-05-281-1/+6
| | | | On macOS, the multiprocessing module now uses the "spawn" start method by default.
* bpo-36888: Add multiprocessing.parent_process() (GH-13247)Thomas Moreau2019-05-208-20/+85
|
* bpo-36867: Create the resource_tracker before launching SharedMemoryManagers ↵Pierre Glaser2019-05-131-0/+9
| | | | (GH-13276)
* bpo-36894: Fix regression in test_multiprocessing_spawn (no tests run on ↵Antoine Pitrou2019-05-131-4/+9
| | | | Windows) (GH-13290)
* bpo-36867: Make semaphore_tracker track other system resources (GH-13222)Pierre Glaser2019-05-106-70/+92
| | | The multiprocessing.resource_tracker replaces the multiprocessing.semaphore_tracker module. Other than semaphores, resource_tracker also tracks shared_memory segments. Patch by Pierre Glaser.
* bpo-36368: Ignore SIGINT in SharedMemoryManager servers. (GH-12483)Pierre Glaser2019-05-101-0/+4
| | | | Fix a bug crashing SharedMemoryManager instances in interactive sessions after a Ctrl-C (KeyboardInterrupt) was sent.
* bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705)Serhiy Storchaka2019-05-061-0/+2
|
* bpo-36766: Typos in docs and code comments (GH-13116)penguindustin2019-05-061-1/+1
|
* bpo-36668: FIX reuse semaphore tracker for child processes (#5172)Thomas Moreau2019-04-241-10/+26
| | | Fix the multiprocessing.semaphore_tracker so it is reused by child processes.
* bpo-36492: Deprecate passing some arguments as keyword arguments. (GH-12637)Serhiy Storchaka2019-04-011-4/+43
| | | | | | | | | | | | | | | | | | | | | | Deprecated passing the following arguments as keyword arguments: - "func" in functools.partialmethod(), weakref.finalize(), profile.Profile.runcall(), cProfile.Profile.runcall(), bdb.Bdb.runcall(), trace.Trace.runfunc() and curses.wrapper(). - "function" in unittest.addModuleCleanup() and unittest.TestCase.addCleanup(). - "fn" in the submit() method of concurrent.futures.ThreadPoolExecutor and concurrent.futures.ProcessPoolExecutor. - "callback" in contextlib.ExitStack.callback(), contextlib.AsyncExitStack.callback() and contextlib.AsyncExitStack.push_async_callback(). - "c" and "typeid" in the create() method of multiprocessing.managers.Server and multiprocessing.managers.SharedMemoryServer. - "obj" in weakref.finalize(). Also allowed to pass arbitrary keyword arguments (even "self" and "func") if the above arguments are passed as positional argument.
* bpo-35493: Use Process.sentinel instead of sleeping for polling worker ↵Pablo Galindo2019-03-161-11/+77
| | | | | | | | | | | | | | | | | | | | status in multiprocessing.Pool (#11488) * bpo-35493: Use Process.sentinel instead of sleeping for polling worker status in multiprocessing.Pool * Use self-pipe pattern to avoid polling for changes * Refactor some variable names and add comments * Restore timeout and poll * Use reader object only on wait() * Recompute worker sentinels every time * Remove timeout and use change notifier * Refactor some methods to be overloaded by the ThreadPool, document the cache class and fix typos
* bpo-36102: Prepend slash to all POSIX shared memory block names (#12036)Davin Potts2019-02-251-4/+10
|
* bpo-35813: Tests and docs for shared_memory (#11816)Davin Potts2019-02-242-319/+392
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added tests for shared_memory submodule. * Added tests for ShareableList. * Fix bug in allocationn size during creation of empty ShareableList illuminated by existing test run on Linux. * Initial set of docs for shared_memory module. * Added docs for ShareableList, added doctree entry for shared_memory submodule, name refactoring for greater clarity. * Added examples to SharedMemoryManager docs, for ease of documentation switched away from exclusively registered functions to some explicit methods on SharedMemoryManager. * Wording tweaks to docs. * Fix test failures on Windows. * Added tests around SharedMemoryManager. * Documentation tweaks. * Fix inappropriate test on Windows. * Further documentation tweaks. * Fix bare exception. * Removed __copyright__. * Fixed typo in doc, removed comment. * Updated SharedMemoryManager preliminary tests to reflect change of not supporting all registered functions on SyncManager. * Added Sphinx doctest run controls. * CloseHandle should be in a finally block in case MapViewOfFile fails. * Missed opportunity to use with statement. * Switch to self.addCleanup to spare long try/finally blocks and save one indentation, change to use decorator to skip test instead. * Simplify the posixshmem extension module. Provide shm_open() and shm_unlink() functions. Move other functionality into the shared_memory.py module. * Added to doc around size parameter of SharedMemory. * Changed PosixSharedMemory.size to use os.fstat. * Change SharedMemory.buf to a read-only property as well as NamedSharedMemory.size. * Marked as provisional per PEP411 in docstring. * Changed SharedMemoryTracker to be private. * Removed registered Proxy Objects from SharedMemoryManager. * Removed shareable_wrap(). * Removed shareable_wrap() and dangling references to it. * For consistency added __reduce__ to key classes. * Fix for potential race condition on Windows for O_CREX. * Remove unused imports. * Update access to kernel32 on Windows per feedback from eryksun. * Moved kernel32 calls to _winapi. * Removed ShareableList.copy as redundant. * Changes to _winapi use from eryksun feedback. * Adopt simpler SharedMemory API, collapsing PosixSharedMemory and WindowsNamedSharedMemory into one. * Fix missing docstring on class, add test for ignoring size when attaching. * Moved SharedMemoryManager to managers module, tweak to fragile test. * Tweak to exception in OpenFileMapping suggested by eryksun. * Mark a few dangling bits as private as suggested by Giampaolo.
* bpo-35918: Remove broken has_key method and add test (#11819)Rémi Lapeyre2019-02-121-1/+1
|
* bpo-35378: Fix multiprocessing.Pool references (GH-11627)Pablo Galindo2019-02-111-38/+74
| | | | | | | | | Changes in this commit: 1. Use a _strong_ reference between the Pool and associated iterators 2. Rework PR #8450 to eliminate a cycle in the Pool. There is no test in this commit because any test that automatically tests this behaviour needs to eliminate the pool before joining the pool to check that the pool object is garbaged collected/does not hang. But doing this will potentially leak threads and processes (see https://bugs.python.org/issue35413).
* bpo-35872 and bpo-35873: Clears __PYVENV_LAUNCHER__ variable (GH-11745)Steve Dower2019-02-042-9/+20
| | | | After reading __PYVENV_LAUNCHER__ we now set sys._base_executable value for later use. Make the same changes for macOS to avoid extra platform checks.
* bpo-35813: Added shared_memory submodule of multiprocessing. (#11664)Davin Potts2019-02-021-0/+573
| | | Added shared_memory submodule to multiprocessing in time for first alpha with cross-platform tests soon to follow.
* bpo-35797: Fix default executable used by the multiprocessing module (GH-11676)Steve Dower2019-01-251-1/+8
|
* bpo-35424: emit ResourceWarning at multiprocessing.Pool destruction (GH-10974)Victor Stinner2018-12-201-5/+18
| | | | multiprocessing.Pool destructor now emits ResourceWarning if the pool is still running.
* bpo-35491, multiprocessing: replace "RUN" with RUN (GH-11178)Victor Stinner2018-12-161-1/+1
|
* bpo-35491: Enhance multiprocessing.BaseProcess.__repr__() (GH-11138)Victor Stinner2018-12-141-11/+16
| | | | | | | | | | | | | | | | * Add the pid and parent pid to multiprocessing.BaseProcess.__repr__(). * Add negative sign (ex: "-SIGTERM") to exitcode (process killed by a signal) * Only call _popen.poll() once. Example: <ForkProcess(ForkPoolWorker-1, started daemon)> becomes: <ForkProcess name='ForkPoolWorker-1' pid=12449 parent=12448 started daemon> Example: <ForkProcess(ForkPoolWorker-1, stopped[SIGTERM] daemon)> becomes: <ForkProcess name='ForkPoolWorker-1' pid=12960 parent=12959 stopped exitcode=-SIGTERM daemon>
* Add multiprocessing.Pool.__repr__() (GH-11137)Victor Stinner2018-12-141-5/+11
| | | | | * Add multiprocessing.Pool.__repr__() to ease debug * RUN, CLOSE and TERMINATE constants values are now strings rather than integer to ease debug
* bpo-35477: multiprocessing.Pool.__enter__() fails if called twice (GH-11134)Victor Stinner2018-12-131-8/+9
| | | | multiprocessing.Pool.__enter__() now fails if the pool is not running: "with pool:" fails if used more than once.
* Revert "bpo-34172: multiprocessing.Pool leaks resources after being deleted ↵Victor Stinner2018-12-061-50/+24
| | | | | (GH-8450)" (GH-10971) This reverts commit 97bfe8d3ebb0a54c8798f57555cb4152f9b2e1d0.
* bpo-35202: Remove unused imports in Lib directory. (GH-10446)Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)2018-11-101-1/+0
|
* bpo-17560: Too small type for struct.pack/unpack in ↵Alexander Buchkovsky2018-11-061-10/+20
| | | | | mutliprocessing.Connection (GH-10305) Allow sending more than 2 GB at once on a multiprocessing connection on non-Windows systems.
* bpo-19675: Terminate processes if construction of a pool is failing. (GH-5614)Julien Palard2018-11-041-2/+10
|
* bpo-22872: multiprocessing.Queue's put() and get() now raise ValueError if ↵Zackery Spytz2018-10-131-2/+6
| | | | | | | the queue is closed. (GH-9010) Previously, put() and get() would raise AssertionError and OSError, respectively.
* bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-8450)tzickel2018-10-021-24/+50
| | | Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
* 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-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113)Serhiy Storchaka2018-09-171-1/+4
|
* bpo-33613, test_semaphore_tracker_sigint: fix race condition (#7850)Pablo Galindo2018-09-041-6/+28
| | | | | | | | | | | | Fail `test_semaphore_tracker_sigint` if no warnings are expected and one is received. Fix race condition when the child receives SIGINT before it can register signal handlers for it. The race condition occurs when the parent calls `_semaphore_tracker.ensure_running()` (which in turn spawns the semaphore_tracker using `_posixsubprocess.fork_exec`), the child registers the signal handlers and the parent tries to kill the child. What seem to happen is that in some slow systems, the parent sends the signal to kill the child before the child protects against the signal.
* Simplify __all__ in multiprocessing (GH-6856)Derek B. Kim2018-07-112-7/+4
|
* bpo-34054: multiprocessing uses time.monotonic() (GH-8118)Victor Stinner2018-07-064-13/+12
| | | | | The multiprocessing module now uses the monotonic clock time.monotonic() instead of the system clock time.time() to implement timeouts.
* bpo-33929: Fix regression in spawn_main() (#7962)Victor Stinner2018-06-271-2/+6
| | | OpenProcess() creates a new handle that must be closed later.
* bpo-33929: multiprocessing: fix handle leak on race condition (GH-7921)Victor Stinner2018-06-273-6/+29
| | | | | | | | | 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-33332: Add signal.valid_signals() (GH-6581)Antoine Pitrou2018-05-041-1/+1
|