classification
Title: test_eintr.test_sigwaitinfo(): race condition on AMD64 FreeBSD 10.x Shared 3.6
Type: Stage: resolved
Components: Tests Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: martin.panter, vstinner
Priority: normal Keywords:

Created on 2017-05-09 16:01 by vstinner, last changed 2017-05-10 17:03 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1523 merged vstinner, 2017-05-09 23:10
PR 1524 merged vstinner, 2017-05-10 00:41
PR 1532 merged vstinner, 2017-05-10 10:39
Messages (6)
msg293332 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-09 16:01
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.6/builds/129/steps/test/logs/stdio

running: test_eintr (584 sec)
0:16:01 [405/405/1] test_eintr failed
test_all (test.test_eintr.EINTRTests) ... FAIL

======================================================================
FAIL: test_all (test.test_eintr.EINTRTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/test_eintr.py", line 18, in test_all
    script_helper.assert_python_ok("-u", tester)
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/support/script_helper.py", line 150, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/support/script_helper.py", line 136, in _assert_python
    err))
AssertionError: Process return code is 1
command line: ['/usr/home/buildbot/python/3.6.koobs-freebsd10/build/python', '-X', 'faulthandler', '-I', '-u', '/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/eintrdata/eintr_tester.py']

stdout:
---
test_read (__main__.OSEINTRTest) ... ok
test_wait (__main__.OSEINTRTest) ... ok
test_wait3 (__main__.OSEINTRTest) ... ok
test_wait4 (__main__.OSEINTRTest) ... ok
test_waitpid (__main__.OSEINTRTest) ... ok
test_write (__main__.OSEINTRTest) ... ok
test_accept (__main__.SocketEINTRTest) ... ok
test_open (__main__.SocketEINTRTest) ... ok
test_os_open (__main__.SocketEINTRTest) ... ok
test_recv (__main__.SocketEINTRTest) ... ok
test_recvmsg (__main__.SocketEINTRTest) ... ok
test_send (__main__.SocketEINTRTest) ... ok
test_sendall (__main__.SocketEINTRTest) ... ok
test_sendmsg (__main__.SocketEINTRTest) ... ok
test_sleep (__main__.TimeEINTRTest) ... ok
test_sigtimedwait (__main__.SignalEINTRTest) ... ok
test_sigwaitinfo (__main__.SignalEINTRTest) ...
---

stderr:
---
Timeout (0:10:00)!
Thread 0x0000000802006400 (most recent call first):
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/eintrdata/eintr_tester.py", line 422 in test_sigwaitinfo
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/case.py", line 601 in run
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/case.py", line 649 in __call__
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 122 in run
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 84 in __call__
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 122 in run
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 84 in __call__
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/runner.py", line 176 in run
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/support/__init__.py", line 1889 in _run_suite
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/support/__init__.py", line 1923 in run_unittest
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/eintrdata/eintr_tester.py", line 492 in test_main
  File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/eintrdata/eintr_tester.py", line 496 in <module>
---

----------------------------------------------------------------------
Ran 1 test in 607.847s

FAILED (failures=1)
test test_eintr failed
msg293361 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-09 23:23
I checked manually in my FreeBSD CURRENT VM that:

* sigwaitinfo() and sigtimedwait() fail with EINTR and automatically restart the interrupted syscall
* running the test in a loop doesn't fail: I ran the test during 5 min in 10 shells (tests running 10 times in parallel) => no failure, the race condition seems to be gone. I hacked the test file to only run the sigwaitinfo() and sigtimedwait() unit tests.
msg293367 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-10 00:37
New changeset 211a392cc15f9a7b1b8ce65d8f6c9f8237d1b77f by Victor Stinner in branch 'master':
bpo-30320: test_eintr now uses pthread_sigmask() (#1523)
https://github.com/python/cpython/commit/211a392cc15f9a7b1b8ce65d8f6c9f8237d1b77f
msg293383 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-10 06:47
New changeset 81ed53784608d44a8d196ad52288b55c7bf665db by Victor Stinner in branch '3.6':
bpo-30320: test_eintr now uses pthread_sigmask() (#1523) (#1524)
https://github.com/python/cpython/commit/81ed53784608d44a8d196ad52288b55c7bf665db
msg293405 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-10 12:13
New changeset dab10f4f5b52c6de1aac3a8b5dc87d2eb0223a6c by Victor Stinner in branch '3.5':
[3.5] bpo-30320, bpo-25277: backport test_eintr enhancements from master to 3.5 (#1532)
https://github.com/python/cpython/commit/dab10f4f5b52c6de1aac3a8b5dc87d2eb0223a6c
msg293441 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-10 17:03
The bug occurs randomly, since it's hard to say at this point if my change fixes it for real or not. I close the bug, but will reopen it if the bug occurs again.

But I'm confident that blocking the signal is "the right fix" for such unit test.
History
Date User Action Args
2017-06-28 01:16:29vstinnerlinkissue25868 superseder
2017-05-10 17:03:40vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg293441

stage: resolved
2017-05-10 12:13:41vstinnersetmessages: + msg293405
2017-05-10 10:39:13vstinnersetpull_requests: + pull_request1631
2017-05-10 06:47:24vstinnersetmessages: + msg293383
2017-05-10 00:41:34vstinnersetpull_requests: + pull_request1623
2017-05-10 00:37:46vstinnersetmessages: + msg293367
2017-05-09 23:23:21vstinnersetmessages: + msg293361
2017-05-09 23:10:05vstinnersetpull_requests: + pull_request1622
2017-05-09 16:01:51vstinnercreate