]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-110206: Fix multiprocessing test_notify_all (GH-130933) (#130951)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 7 Mar 2025 17:20:00 +0000 (18:20 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Mar 2025 17:20:00 +0000 (12:20 -0500)
commit42306978867e8999a32c99bb96923aa1bed4a42a
treeeb1da781cb0deafe7d16bfddcca3cb2f04a02916
parent56fa6f39ff5f751529ca42db79fe65e28af96112
[3.12] gh-110206: Fix multiprocessing test_notify_all (GH-130933) (#130951)

The test could deadlock trying join on the worker processes due to a
combination of behaviors:

* The use of `assertReachesEventually` did not ensure that workers
  actually woken.release() because the SyncManager's Semaphore does not
  implement get_value.

* This mean that the test could finish and the variable "sleeping" would
  got out of scope and be collected. This unregisters the proxy leading
  to failures in the worker or possibly the manager.

* The subsequent call to `p.join()` during cleanUp therefore never
  finished.

This takes two approaches to fix this:

1) Use woken.acquire() to ensure that the workers actually finish
   calling woken.release()

2) At the end of the test, wait until the workers are finished, while `cond`,
   `sleeping`, and `woken` are still valid.
(cherry picked from commit c476410dc5ae62ffb5e32f64f9a3a622485c7d93)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Lib/test/_test_multiprocessing.py