[issue19096] multiprocessing.Pool._terminate_pool restarts workers during shutdown

Edward Catmur report at bugs.python.org
Thu Sep 26 11:45:37 CEST 2013


Edward Catmur added the comment:

Suggested patch: https://bitbucket.org/ecatmur/cpython/compare/19096-multiprocessing-race..#diff

Move the worker_handler.join() to immediately after setting the worker handler thread state to TERMINATE.  This is a safe change as nothing in the moved-over code affects the worker handler thread, except by terminating workers which is precisely what we don't want to happen.  In addition, this is near-equivalent behaviour to current close() + join(), which is well-tested.

Also: write tests; and modify Pool.__init__ to refer to its static methods using self rather than class name, to make them overridable for testing purposes.

----------
hgrepos: +211

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19096>
_______________________________________


More information about the Python-bugs-list mailing list