summaryrefslogtreecommitdiffstats
path: root/Lib/test/_test_multiprocessing.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-45310: Fix parrallel shared memory tests (GH-28661) (GH-28979)Victor Stinner2021-10-191-15/+23
| | | | | | | | | Add a PID to names of POSIX shared memory objects to allow running multiprocessing tests (test_multiprocessing_fork, test_multiprocessing_spawn, etc) in parallel. (cherry picked from commit eb4495e8e275c83d691add116c4f2b74e73e3cc8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556) ↵Miss Islington (bot)2020-08-301-0/+12
| | | | | | | | | (GH-22019) (cherry picked from commit 475a5fbb5644ea200c990d85d8c264e78ab6c7ea) Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com> Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
* [3.8] bpo-41043: Escape literal part of the path for glob(). (GH-20994). ↵Serhiy Storchaka2020-07-021-1/+1
| | | | | (GH-21277) (cherry picked from commit 935586845815f5b4c7814794413f6a812d4bd45f)
* bpo-38377: Add support.skip_if_broken_multiprocessing_synchronize() ↵Victor Stinner2020-06-181-1/+1
| | | | | | | | | | | (GH-20944) (GH-20962) (GH-20966) On Linux, skip tests using multiprocessing if the current user cannot create a file in /dev/shm/ directory. Add the skip_if_broken_multiprocessing_synchronize() function to the test.support module. (cherry picked from commit ddbeb2f3e02a510c5784ffd74c5e09e8c70b5881) (cherry picked from commit b1e736113484c99acb57e4acb417b91a9e58e7ff)
* bpo-39244: multiprocessing return default start method first on macOS (GH-18625)Miss Islington (bot)2020-05-261-1/+3
| | | | | (cherry picked from commit db098bc1f05bd0773943e59f83489f05f28dedf8) Co-authored-by: idomic <michael.ido@gmail.com>
* bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892)Miss Islington (bot)2020-05-041-1/+3
| | | | | | | Don't define shared memory block's name in test_shared_memory_across_processes(): use SharedMemory(create=True) instead. (cherry picked from commit caa3ef284a2e5e5b9bdd6a9e619804122c842d80) Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-39983: Add test.support.print_warning() (GH-19683) (GH-19687)Victor Stinner2020-04-231-19/+13
| | | | | | | | | Log "Warning -- ..." test warnings into sys.__stderr__ rather than sys.stderr, to ensure to display them even if sys.stderr is captured. test.libregrtest.utils.print_warning() now calls test.support.print_warning(). (cherry picked from commit d663d34685e18588748569468c672763f4c73b3e)
* [3.8] bpo-40330: Fix utf-8 size check in ShareableList (GH-19606) (GH-19625)Antoine Pitrou2020-04-201-2/+14
| | | | | | | | 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>
* bpo-39360: Ensure all workers exit when finalizing a multiprocessing Pool ↵Miss Islington (bot)2020-03-151-0/+18
| | | | | | | | | | | | (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-091-0/+13
| | | | | (GH-18866) (GH-18876) (cherry picked from commit 6012f30beff7fa8396718dfb198ccafc333c565b)
* bpo-38546: multiprocessing tests stop the resource tracker (GH-17641) (GH-17647)Victor Stinner2019-12-181-10/+1
| | | | | | | | | | | | 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/+22
| | | | | | | | | | | | | | | | 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-37123: multiprocessing test_mymanager() accepts SIGTERM (GH-16349)Miss Islington (bot)2019-09-241-5/+6
| | | | | | | | | | | Multiprocessing test test_mymanager() now also expects -SIGTERM, not only exitcode 0. bpo-30356: BaseManager._finalize_manager() sends SIGTERM to the manager process if it takes longer than 1 second to stop, which happens on slow buildbots. (cherry picked from commit b0e1ae5f5430433766e023c1a6936aeba0f2b84e) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-38212: Increase MP test_queue_feeder_donot_stop_onexc() timeout (GH-16348)Miss Islington (bot)2019-09-241-2/+1
| | | | | | | Multiprocessing tests: increase test_queue_feeder_donot_stop_onexc() timeout from 1 to 60 seconds. (cherry picked from commit 99799c722065d0524f3ab0bc455e1938bb8dc60f) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-37558: Shared memory tests are failing due to double slashes (GH-14703)Miss Islington (bot)2019-07-111-1/+1
| | | | | | | | With the addition of shared memory into Python 3.8, we now have three tests failing on Solaris, namely `test_multiprocessing_fork`, `test_multiprocessing_forkserver` and `test_multiprocessing_spawn`. The reason seems to be incorrect name handling which results in two slashes being prepended. https://bugs.python.org/issue37558 (cherry picked from commit 4737265622251756a9480ab84af2442b6b986850) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* bpo-37421: multiprocessing tests now stop ForkServer (GH-14601)Miss Islington (bot)2019-07-051-0/+6
| | | | | | | | 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: multiprocessing tests call _run_finalizers() (GH-14527)Miss Islington (bot)2019-07-021-0/+3
| | | | | | | | multiprocessing tests now call explicitly _run_finalizers() to remove immediately temporary directories created by multiprocessing.util.get_temp_dir(). (cherry picked from commit 039fb49c185570ab7b02f13fbdc51c859cfd831e) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37244: Fix test_multiprocessing.test_resource_tracker() (GH-14288)Miss Islington (bot)2019-06-251-6/+15
| | | | | | Increase robustness of test_resource_tracker(): retry for 60 seconds. (cherry picked from commit e1a63c4f21011a3ae77dff624196561070c83446) Co-authored-by: Pierre Glaser <pierreglaser@msn.com>
* bpo-36888, test_multiprocessing: Increase test_parent_process timeout (GH-14286)Miss Islington (bot)2019-06-251-3/+3
| | | | | (cherry picked from commit 594d9b9f58e1ef0a60b5ce9e590e0f45cd684f26) Co-authored-by: Pierre Glaser <pierreglaser@msn.com>
* bpo-36888: Add multiprocessing.parent_process() (GH-13247)Thomas Moreau2019-05-201-0/+59
|
* bpo-36867: _test_multiprocessing: avoid weak sync primitive (GH-13292)Pierre Glaser2019-05-171-4/+12
| | | Avoid weak sync primitive in multiprocessing resource_tracker test.
* bpo-36867: Create the resource_tracker before launching SharedMemoryManagers ↵Pierre Glaser2019-05-131-14/+44
| | | | (GH-13276)
* bpo-36867: Make semaphore_tracker track other system resources (GH-13222)Pierre Glaser2019-05-101-54/+116
| | | 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/+24
| | | | Fix a bug crashing SharedMemoryManager instances in interactive sessions after a Ctrl-C (KeyboardInterrupt) was sent.
* bpo-36668: FIX reuse semaphore tracker for child processes (#5172)Thomas Moreau2019-04-241-0/+28
| | | Fix the multiprocessing.semaphore_tracker so it is reused by child processes.
* bpo-35934: Add socket.create_server() utility function (GH-11784)Giampaolo Rodola2019-04-081-6/+2
|
* Raise the timeout in test_multiprocessing_* for slow buildbots (GH-12489)Pablo Galindo2019-03-221-1/+1
|
* bpo-35813: Tests and docs for shared_memory (#11816)Davin Potts2019-02-241-33/+285
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-2/+0
|
* bpo-35378: Fix multiprocessing.Pool references (GH-11627)Pablo Galindo2019-02-111-1/+0
| | | | | | | | | 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).
* Make sure the BaseManager in test_multiprocessing is cleaned up correctly ↵Pablo Galindo2019-02-091-15/+20
| | | | (GH-11653)
* Do not retain references to processes and managers in TestSyncManagerTypes ↵Pablo Galindo2019-02-091-0/+2
| | | | | (GH-11801) Keeping references to processes and managers between tests makes them count as dangling processes.
* bpo-35917: Test multiprocessing manager classes and shareable types (GH-11772)Giampaolo Rodola2019-02-071-0/+246
| | | | multiprocessing: provide unittests for manager classes and shareable types
* bpo-35424: emit ResourceWarning at multiprocessing.Pool destruction (GH-10974)Victor Stinner2018-12-201-0/+16
| | | | multiprocessing.Pool destructor now emits ResourceWarning if the pool is still running.
* bpo-35513: Replace time.time() with time.monotonic() in tests (GH-11182)Victor Stinner2018-12-171-20/+20
| | | | | | | Replace time.time() with time.monotonic() in tests to measure time delta. test_zipfile64: display progress every minute (60 secs) rather than every 5 minutes (5*60 seconds).
* bpo-35477: multiprocessing.Pool.__enter__() fails if called twice (GH-11134)Victor Stinner2018-12-131-0/+16
| | | | multiprocessing.Pool.__enter__() now fails if the pool is not running: "with pool:" fails if used more than once.
* bpo-35424: test_multiprocessing: join 3 pools (GH-10986)Victor Stinner2018-12-061-0/+3
| | | | | | Join 3 pools in these tests: * test.test_multiprocessing_spawn.WithProcessesTestPool.test_context * test.test_multiprocessing_spawn.WithProcessesTestPool.test_traceback
* Revert "bpo-34172: multiprocessing.Pool leaks resources after being deleted ↵Victor Stinner2018-12-061-7/+0
| | | | | (GH-8450)" (GH-10971) This reverts commit 97bfe8d3ebb0a54c8798f57555cb4152f9b2e1d0.
* bpo-33676: Fix dangling thread in _test_multiprocessing (GH-10755)Victor Stinner2018-11-281-0/+2
| | | | | | | Fix WithThreadsTestPool.test_wrapped_exception() of test_multiprocessing_fork: join the pool. WithThreadsTestPool.test_del_pool() is now also decorated with @support.reap_threads.
* bpo-35202: Remove unused imports in Lib directory (GH-10450)Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)2018-11-151-1/+0
|
* bpo-19675: Terminate processes if construction of a pool is failing. (GH-5614)Julien Palard2018-11-041-0/+43
|
* bpo-22872: multiprocessing.Queue's put() and get() now raise ValueError if ↵Zackery Spytz2018-10-131-0/+8
| | | | | | | the queue is closed. (GH-9010) Previously, put() and get() would raise AssertionError and OSError, respectively.
* bpo-33613: Fix test_semaphore_tracker signal tests when using -Werror (GH-9778)Pablo Galindo2018-10-101-2/+4
| | | | | | Tests involving sending signals to the semaphore_tracker will not fail anymore due to the fact that running the test suite with -Werror propagates warnings as errors. Fix a missing assertion when the semaphore_tracker is expected to die.
* bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-8450)tzickel2018-10-021-0/+6
| | | 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-31370: Remove references to threadless builds (#8805)Zackery Spytz2018-09-291-3/+0
| | | Support for threadless builds was removed in a6a4dc81.
* bpo-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113)Serhiy Storchaka2018-09-171-0/+23
|
* bpo-33613, test_semaphore_tracker_sigint: fix race condition (#7850)Pablo Galindo2018-09-041-6/+21
| | | | | | | | | | | | 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.
* bpo-30317: Fix multiprocessing test_timeout() (GH-8621)Victor Stinner2018-08-031-3/+4
| | | | | Multiprocessing test_timeout() now accepts a delta of 100 ms instead of just 50 ms, since the test failed with 135.8 ms instead of the expected 200 ms.
* Simplify __all__ in multiprocessing (GH-6856)Derek B. Kim2018-07-111-0/+6
|
* bpo-34040, multiprocessing: Fix test_forkserver_sigkill() (GH-8081)Victor Stinner2018-07-041-2/+6
| | | | | | | | Fix test_forkserver_sigkill() of test_multiprocessing_forkserver: give more time to the first child process to complete, double the sleep in the parent process. Reduce also the child process sleep from 1000 ms to 500 ms, to not change the total duration of the test.