]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-109917: Fix test instability in test_concurrent_futures (GH-110306) (#110316)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 3 Oct 2023 22:27:56 +0000 (15:27 -0700)
committerGitHub <noreply@github.com>
Tue, 3 Oct 2023 22:27:56 +0000 (23:27 +0100)
commit4e44927a0e80e85f68f26dcba06702022bd9f884
treeeb779be3a2a24ce4b4b36085527f631d6c347ed4
parent6a6e8871ba0dcf4332093e198a876957651768ed
[3.11] gh-109917: Fix test instability in test_concurrent_futures (GH-110306) (#110316)

gh-109917: Fix test instability in test_concurrent_futures (GH-110306)

The test had an instability issue due to the ordering of the dummy
queue operation and the real wakeup pipe operations. Both primitives
are thread safe but not done atomically as a single update and may
interleave arbitrarily. With the old order of operations this can lead
to an incorrect state where the dummy queue is full but the wakeup
pipe is empty. By swapping the order in clear() I think this can no
longer happen in any possible operation interleaving (famous last
words).
(cherry picked from commit a376a72bd92cd7c9930467dd1aba40045fb75e3b)

Co-authored-by: elfstrom <elfstrom@users.noreply.github.com>
Lib/test/test_concurrent_futures/test_deadlock.py