Skip to content

bpo-47075: Add shutdown_timeout to multiprocessing BaseManager#32112

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:mp_shutdown_timeout
Apr 19, 2022
Merged

bpo-47075: Add shutdown_timeout to multiprocessing BaseManager#32112
vstinner merged 1 commit into
python:mainfrom
vstinner:mp_shutdown_timeout

Conversation

@vstinner

@vstinner vstinner commented Mar 25, 2022

Copy link
Copy Markdown
Member

Add an optional keyword 'shutdown_timeout' parameter to the
multiprocessing.BaseManager constructor.

Multiprocessing tests pass test.support.SHORT_TIMEOUT
to BaseManager.shutdown_timeout.

https://bugs.python.org/issue47075

@vstinner

Copy link
Copy Markdown
Member Author

I don't think that having two separated timeout parameters, one for wait() and a second for join(), is needed. I prefer to have a single value. The process should be able to handle the shutdown command in 1.0 second, if it doesn't, terminate() should terminate it immediately and 1.0 should be enough to wait until the process is killed, no?

cc @pitrou @pablogsal

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on the principle.

Comment thread Lib/multiprocessing/managers.py Outdated
Comment thread Doc/library/multiprocessing.rst Outdated
@vstinner

vstinner commented Apr 1, 2022

Copy link
Copy Markdown
Member Author

@pitrou: Would you mind reviewing the updated PR? I completed the doc and changed the behavior: kill the process if it is still alive shutdown_timeout seconds after being terminated.

Add an optional keyword 'shutdown_timeout' parameter to the
multiprocessing.BaseManager constructor. Kill the process if
terminate() takes longer than the timeout.

Multiprocessing tests pass test.support.SHORT_TIMEOUT
to BaseManager.shutdown_timeout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants