Skip to content

test_notify multiprocessing test is flaky #130737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
colesbury opened this issue Mar 1, 2025 · 4 comments
Closed

test_notify multiprocessing test is flaky #130737

colesbury opened this issue Mar 1, 2025 · 4 comments
Labels
tests Tests in the Lib/test dir topic-free-threading topic-multiprocessing type-bug An unexpected behavior, bug, or error

Comments

@colesbury
Copy link
Contributor

colesbury commented Mar 1, 2025

Bug report

Seen in https://github.com/python/cpython/actions/runs/13606907022/job/38039459160?pr=130732

FAIL: test_notify (test.test_multiprocessing_spawn.test_threads.WithThreadsTestCondition.test_notify)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\cpython\cpython\Lib\test\_test_multiprocessing.py", line 1691, in test_notify
    self.assertReturnsIfImplemented(2, get_value, woken)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "D:\a\cpython\cpython\Lib\test\_test_multiprocessing.py", line 275, in assertReturnsIfImplemented
    return self.assertEqual(value, res)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
AssertionError: 2 != 1

Linked PRs

@colesbury colesbury added tests Tests in the Lib/test dir topic-multiprocessing type-bug An unexpected behavior, bug, or error labels Mar 1, 2025
vstinner added a commit to vstinner/cpython that referenced this issue Mar 3, 2025
Replace hardcoded delay (DELTA) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
vstinner added a commit to vstinner/cpython that referenced this issue Mar 3, 2025
Replace hardcoded delay (DELTA) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
vstinner added a commit to vstinner/cpython that referenced this issue Mar 3, 2025
Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
@vstinner
Copy link
Member

vstinner commented Mar 3, 2025

Well, the test uses a sleep of 100 ms as a synchronization method, it's not reliable. I wrote PR #130797 to wait until a condition is met using a loop.

vstinner added a commit that referenced this issue Mar 3, 2025
Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 3, 2025
Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
(cherry picked from commit 8a64a62)

Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 3, 2025
Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
(cherry picked from commit 8a64a62)

Co-authored-by: Victor Stinner <[email protected]>
@vstinner vstinner closed this as completed Mar 3, 2025
vstinner added a commit that referenced this issue Mar 3, 2025
)

gh-130737: Fix multiprocessing test_notify() (GH-130797)

Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
(cherry picked from commit 8a64a62)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Mar 3, 2025
)

gh-130737: Fix multiprocessing test_notify() (GH-130797)

Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
(cherry picked from commit 8a64a62)

Co-authored-by: Victor Stinner <[email protected]>
@encukou
Copy link
Member

encukou commented Mar 7, 2025

Since the backports were merged, Refleaks tests (mainly Windows) are often failing, see:

@encukou encukou reopened this Mar 7, 2025
@colesbury
Copy link
Contributor Author

#130933 should fix the buildbot failures.

@kumaraditya303
Copy link
Contributor

Fixed by #130933

seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-free-threading topic-multiprocessing type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants