Closed
Description
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