classification
Title: [Easy][Windows] test_subprocess: test_close_fds_with_stdio() has a race condition
Type: Stage:
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: pablogsal, vstinner
Priority: normal Keywords: easy

Created on 2019-04-23 08:00 by vstinner, last changed 2019-04-23 08:07 by vstinner.

Messages (1)
msg340698 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-23 08:00
test_subprocess: test_close_fds_with_stdio() pass when run alone, but fail when run in parallel.

I tagged the issue as "easy" for new contributors to Python. If someone is interested to work on this issue, please contact me in private.


https://buildbot.python.org/all/#/builders/3/builds/2446

I can reproduce the issue.

The test pass when run alone:

> python -m test test_subprocess -m test_close_fds_with_stdio  -v
Running Debug|x64 interpreter...
== CPython 3.7.3+ (heads/3.7:9344d74f7b, Apr 23 2019, 09:53:41) [MSC v.1915 64 bit (AMD64)]
== Windows-10-10.0.17763-SP0 little-endian
== cwd: C:\vstinner\python\3.7\build\test_python_6116
== CPU count: 2
== encodings: locale=cp1252, FS=utf-8
Run tests sequentially
0:00:00 [1/1] test_subprocess
test_close_fds_with_stdio (test.test_subprocess.Win32ProcessTestCase) ... ok

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

Ran 1 test in 0.302s

OK

== Tests result: SUCCESS ==

1 test OK.

Total duration: 391 ms
Tests result: SUCCESS


But the test fails when run in parallel:

> python -m test test_subprocess -m test_close_fds_with_stdio -F -j4
Running Debug|x64 interpreter...
Run tests in parallel using 4 child processes
0:00:01 [  1/1] test_subprocess failed
test test_subprocess failed -- Traceback (most recent call last):
  File "C:\vstinner\python\3.7\lib\test\test_subprocess.py", line 2930, in test_close_fds_with_stdio
    self.assertEqual(p.returncode, 1)
AssertionError: 0 != 1
0:00:01 [  2/1] test_subprocess passed
0:00:01 [  3/2] test_subprocess failed
test test_subprocess failed -- Traceback (most recent call last):
  File "C:\vstinner\python\3.7\lib\test\test_subprocess.py", line 2930, in test_close_fds_with_stdio
    self.assertEqual(p.returncode, 1)
AssertionError: 0 != 1
0:00:01 [  4/3] test_subprocess failed
test test_subprocess failed -- Traceback (most recent call last):
  File "C:\vstinner\python\3.7\lib\test\test_subprocess.py", line 2942, in test_close_fds_with_stdio
    self.assertEqual(p.returncode, 1)
AssertionError: 0 != 1
0:00:02 [  5/3] test_subprocess passed
0:00:02 [  6/3] test_subprocess passed

== Tests result: FAILURE ==

3 tests OK.

3 tests failed:
    test_subprocess test_subprocess test_subprocess

Total duration: 2 sec 313 ms
Tests result: FAILURE
History
Date User Action Args
2019-04-23 08:07:54vstinnersetnosy: + pablogsal
2019-04-23 08:00:42vstinnercreate