mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-90622: Prevent max_tasks_per_child use with a fork mp_context. (#91587)
Prevent `max_tasks_per_child` use with a "fork" mp_context to avoid deadlocks. Also defaults to "spawn" when no mp_context is supplied for safe convenience.
This commit is contained in:
parent
2b563f1ad3
commit
fa4f0a134e
4 changed files with 43 additions and 11 deletions
|
@ -254,8 +254,11 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
|
|||
|
||||
*max_tasks_per_child* is an optional argument that specifies the maximum
|
||||
number of tasks a single process can execute before it will exit and be
|
||||
replaced with a fresh worker process. The default *max_tasks_per_child* is
|
||||
``None`` which means worker processes will live as long as the pool.
|
||||
replaced with a fresh worker process. By default *max_tasks_per_child* is
|
||||
``None`` which means worker processes will live as long as the pool. When
|
||||
a max is specified, the "spawn" multiprocessing start method will be used by
|
||||
default in absense of a *mp_context* parameter. This feature is incompatible
|
||||
with the "fork" start method.
|
||||
|
||||
.. versionchanged:: 3.3
|
||||
When one of the worker processes terminates abruptly, a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue