cpython/Lib/multiprocessing
Victor Stinner 356de021d7
[3.12] gh-109047: concurrent.futures catches RuntimeError (#109810) (#110126)
gh-109047: concurrent.futures catches PythonFinalizationError (#109810)

concurrent.futures: The *executor manager thread* now catches
exceptions when adding an item to the *call queue*. During Python
finalization, creating a new thread can now raise RuntimeError. Catch
the exception and call terminate_broken() in this case.

Add test_python_finalization_error() to test_concurrent_futures.

concurrent.futures._ExecutorManagerThread changes:

* terminate_broken() no longer calls shutdown_workers() since the
  call queue is no longer working anymore (read and write ends of
  the queue pipe are closed).
* terminate_broken() now terminates child processes, not only
  wait until they complete.
* _ExecutorManagerThread.terminate_broken() now holds shutdown_lock
  to prevent race conditons with ProcessPoolExecutor.submit().

multiprocessing.Queue changes:

* Add _terminate_broken() method.
* _start_thread() sets _thread to None on exception to prevent
  leaking "dangling threads" even if the thread was not started
  yet.

(cherry picked from commit 6351842121)
2023-10-02 17:47:10 +02:00
..
dummy bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700) 2019-06-01 11:00:15 +03:00
__init__.py Simplify __all__ in multiprocessing (GH-6856) 2018-07-11 19:22:28 +09:00
connection.py [3.12] gh-107219: Fix concurrent.futures terminate_broken() (GH-109244) (#109254) 2023-10-02 16:56:09 +02:00
context.py gh-84559: Remove the new multiprocessing warning, too disruptive. (#101551) 2023-02-03 15:20:46 -08:00
forkserver.py [3.12] gh-107963: Fix set_forkserver_preload to check the type of given list (GH-107965) (#107975) 2023-08-15 16:56:53 +02:00
heap.py bpo-32759: Free unused arenas in multiprocessing.heap (GH-5827) 2018-04-09 17:37:55 +02:00
managers.py gh-97816: Remove unused variables in mutliprocessing.managers.Server (#97817) 2022-10-03 22:29:17 -07:00
pool.py Fix typo in exception message in multiprocessing.pool (#99900) 2022-11-30 20:57:28 +05:30
popen_fork.py bpo-40094: Add os.waitstatus_to_exitcode() (GH-19201) 2020-04-01 18:49:29 +02:00
popen_forkserver.py bpo-36888: Add multiprocessing.parent_process() (GH-13247) 2019-05-20 21:37:05 +02:00
popen_spawn_posix.py bpo-36888: Add multiprocessing.parent_process() (GH-13247) 2019-05-20 21:37:05 +02:00
popen_spawn_win32.py [3.12] gh-110036: multiprocessing Popen.terminate() catches PermissionError (GH-110037) (#110064) 2023-10-02 17:44:26 +02:00
process.py gh-104536: Improve multiprocessing.process._cleanup logic (#104537) 2023-05-22 03:48:57 +00:00
queues.py [3.12] gh-109047: concurrent.futures catches RuntimeError (#109810) (#110126) 2023-10-02 17:47:10 +02:00
reduction.py bpo-34521: Fix tests in test_multiprocessing_spawn to use correctly CMSG_SPACE (GH-9613) 2018-09-28 02:51:05 -07:00
resource_sharer.py bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19511) 2020-04-15 01:35:36 +09:00
resource_tracker.py [3.12] gh-109593: Fix reentrancy issue in multiprocessing resource_tracker (GH-109629) (#109898) 2023-10-02 17:37:40 +02:00
shared_memory.py bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684) 2022-11-25 17:39:48 +00:00
sharedctypes.py bpo-32157: Removed explicit quotes around %r and {!r}. (#4582) 2017-11-28 22:54:42 +02:00
spawn.py [3.12] More actionable error message when spawn is incorrectly used. (GH-102203) (#107990) 2023-08-16 14:22:22 +02:00
synchronize.py [3.12] gh-108520: Fix bad fork detection in nested multiprocessing use case (GH-108568) (#108691) 2023-08-30 23:18:49 +02:00
util.py gh-82616: Add process_group support to subprocess.Popen (#23930) 2022-05-05 16:22:32 -07:00