cpython/Lib/test/test_concurrent_futures
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
..
__init__.py
executor.py [3.12] gh-108834: Sync libregrtest with the main branch (#108966) 2023-09-08 15:14:17 +02:00
test_as_completed.py [3.12] gh-109565: Fix concurrent.futures test_future_times_out() (GH-109949) (#109952) 2023-10-02 17:40:16 +02:00
test_deadlock.py [3.12] gh-109832: concurrent.futures test_deadlock restores sys.stderr (GH-109887) (#109892) 2023-10-02 17:37:25 +02:00
test_future.py
test_init.py
test_process_pool.py [3.12] gh-109047: concurrent.futures catches RuntimeError (#109810) (#110126) 2023-10-02 17:47:10 +02:00
test_shutdown.py
test_thread_pool.py
test_wait.py [3.12] gh-109594: Fix concurrent.futures test_timeout() (GH-110018) (#110021) 2023-10-02 17:42:03 +02:00
util.py