When max_tasks_per_child is set, the ProcessPoolExecutor uses a spawn
multiprocessing context which starts a new process from scratch with a __name__
being __mp_main__ which prevents the configuration to be restored.
So in the ProcessPoolExecutor initializer the configuration is restored using
the initial options.
Closes#14843
(grafted from cb5c6667ac51818d49ca397347419a40b88768fd)
--HG--
branch : 8.0
An instance of pool is created per thread and it stores a reference to the
current pool values.
When the pool is initialized, a temporary reference is set on the instance so
only the values for this thread is modified. Once the initialization is
complete, the new pool value replace the global values.
Each instances is refreshed with the global values after the pool has been
stopped.
Closes#11401
Unlike multiprocessing pools, the concurrent library pools will raise an
exception if child processes have died and can't accept further tasks. This
should cause the main worker to stop instead of stalling in an inifinite wait.
Introduce a dummy noop execution in the pool to probe if it is still operative
to mitigate the volume of lost tasks if the next submited execution would raise
a BrokenExecutor exception. This isn't 100% bulletproof because the pool might
still break between the probe and a new task being pulled.
The maxtasksperchild CLI option will only work for Python 3.11 onwards because
former concurrent.futures pools do not support this option.
Closes#11104