Skip to content
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

test_multiprocessing_fork: test_nested_startmethod() fails randomly. #109706

Closed
vstinner opened this issue Sep 22, 2023 · 0 comments
Closed

test_multiprocessing_fork: test_nested_startmethod() fails randomly. #109706

vstinner opened this issue Sep 22, 2023 · 0 comments
Labels
tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Sep 22, 2023

test_nested_startmethod() fails randomly. Since there is no synchronization, putting items in the queue is not really ordered.

I suggest to either accept [1, 2] and [2, 1] in the test, or add some kind of synchronization to ensure that events happen in the expected order. Here I don't think that order matters.

The test was added by PR #108568 of issue gh-108520.

FAIL: test_nested_startmethod (test.test_multiprocessing_fork.test_misc.TestStartMethod.test_nested_startmethod)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-ppc64le.lto/build/Lib/test/_test_multiprocessing.py", line 5475, in test_nested_startmethod
    self.assertEqual(results, [2, 1])
AssertionError: Lists differ: [1, 2] != [2, 1]

First differing element 0:
1
2

- [1, 2]
+ [2, 1]

build: https://buildbot.python.org/all/#/builders/503/builds/3941

The failure can be reproduced by stressing the test:

$ ./python -m test test_multiprocessing_fork.test_misc -m test_nested_startmethod -v -j50 --forever
(...)
0:00:24 load avg: 20.03 [157/1] test_multiprocessing_fork.test_misc failed (1 failure)
test_nested_startmethod (test.test_multiprocessing_fork.test_misc.TestStartMethod.test_nested_startmethod) ... FAIL

======================================================================
FAIL: test_nested_startmethod (test.test_multiprocessing_fork.test_misc.TestStartMethod.test_nested_startmethod)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/3.11/Lib/test/_test_multiprocessing.py", line 5399, in test_nested_startmethod
    self.assertEqual(results, [2, 1])
AssertionError: Lists differ: [1, 2] != [2, 1]

First differing element 0:
1
2

- [1, 2]
+ [2, 1]

----------------------------------------------------------------------
Ran 1 test in 2.150s

FAILED (failures=1)
test test_multiprocessing_fork.test_misc failed

Linked PRs

@vstinner vstinner added the tests Tests in the Lib/test dir label Sep 22, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Sep 22, 2023
Don't check order, queue items can be written in any order.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 22, 2023
Don't check order, queue items can be written in any order.
vstinner added a commit that referenced this issue Sep 22, 2023
Don't check order, queue items can be written in any order.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 22, 2023
…nGH-109707)

Don't check order, queue items can be written in any order.
(cherry picked from commit b03a791)

Co-authored-by: Victor Stinner <vstinner@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 22, 2023
…nGH-109707)

Don't check order, queue items can be written in any order.
(cherry picked from commit b03a791)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this issue Sep 22, 2023
…09707) (#109763)

gh-109706: Fix multiprocessing test_nested_startmethod() (GH-109707)

Don't check order, queue items can be written in any order.
(cherry picked from commit b03a791)

Co-authored-by: Victor Stinner <vstinner@python.org>
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
…n#109707)

Don't check order, queue items can be written in any order.
Yhg1s pushed a commit that referenced this issue Oct 2, 2023
…09707) (#109762)

gh-109706: Fix multiprocessing test_nested_startmethod() (GH-109707)

Don't check order, queue items can be written in any order.
(cherry picked from commit b03a791)

Co-authored-by: Victor Stinner <vstinner@python.org>
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
Projects
None yet
Development

No branches or pull requests

1 participant