This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2020-04-01.13:18:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585747098.48.0.62220441008.issue40135@roundup.psfhosted.org>
In-reply-to
Content
Sometimes, I need to run multiprocessing tests multiple times in parallel to attempt to reproduce a race condition. Except that test_shared_memory_across_processes() fails in this case:

$ ./python -m test test_multiprocessing_spawn --fail-env-changed -v -j4 -F -m test_shared_memory_across_processes 

== CPython 3.9.0a5+ (heads/master:17b4733f2f, Apr 1 2020, 15:02:04) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
== Linux-5.5.9-200.fc31.x86_64-x86_64-with-glibc2.30 little-endian
== cwd: /home/vstinner/python/master/build/test_python_1133450
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 1.64 Run tests in parallel using 4 child processes
0:00:01 load avg: 1.64 [  1/1] test_multiprocessing_spawn failed
test_shared_memory_across_processes (test.test_multiprocessing_spawn.WithProcessesTestSharedMemory) ... ERROR

======================================================================
ERROR: test_shared_memory_across_processes (test.test_multiprocessing_spawn.WithProcessesTestSharedMemory)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/_test_multiprocessing.py", line 3862, in test_shared_memory_across_processes
    sms = shared_memory.SharedMemory('test02_tsmap', True, size=512)
  File "/home/vstinner/python/master/Lib/multiprocessing/shared_memory.py", line 100, in __init__
    self._fd = _posixshmem.shm_open(
FileExistsError: [Errno 17] File exists: '/test02_tsmap'

----------------------------------------------------------------------

Ran 1 test in 0.247s

FAILED (errors=1)
test test_multiprocessing_spawn failed
Kill <TestWorkerProcess #2 running test=test_multiprocessing_spawn pid=1133458 time=1.2 sec> process group
Kill <TestWorkerProcess #3 running test=test_multiprocessing_spawn pid=1133457 time=1.2 sec> process group
Kill <TestWorkerProcess #4 running test=test_multiprocessing_spawn pid=1133459 time=1.2 sec> process group

== Tests result: FAILURE ==

1 test failed:
    test_multiprocessing_spawn

Total duration: 1.2 sec
Tests result: FAILURE
History
Date User Action Args
2020-04-01 13:18:18vstinnersetrecipients: + vstinner
2020-04-01 13:18:18vstinnersetmessageid: <1585747098.48.0.62220441008.issue40135@roundup.psfhosted.org>
2020-04-01 13:18:18vstinnerlinkissue40135 messages
2020-04-01 13:18:18vstinnercreate