Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Dec 13, 2018

The multiprocessing.Pool.join() method now completes as soon as
possible. Previously, it always had to wait at least 100 ms.

multiprocessing.Pool._worker_handler() now waits on threading events
rather than using naive time.sleep(0.1).

When the pool is closed, a delay of 100 ms is still needed because of
bpo-35478 bug (pending results never complete if the pool is
terminated) to check if thread._state has been set to TERMINATE in
the meanwhile.

https://bugs.python.org/issue35479

The multiprocessing.Pool.join() method now completes as soon as possible. Previously, it always had to wait at least 100 ms. multiprocessing.Pool._worker_handler() now waits on threading events rather than using naive time.sleep(0.1). When the pool is closed, a delay of 100 ms is still needed because of bpo-35478 bug (pending results never complete if the pool is terminated) to check if thread._state has been set to TERMINATE in the meanwhile.
@vstinner
Copy link
Member Author

vstinner commented Dec 14, 2018

test_pool_worker_lifetime() hangs with this change.

My change doesn't work: self._worker_state_event isn't set when a worker completes, whereas _maintain_pool() should be called frequently to check when a worker completed.

@vstinner
Copy link
Member Author

https://bugs.python.org/issue35479 and this PR have multiple issues, I close the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment