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.

classification
Title: test_io.check_interrupted_write() sporadic failures on FreeBSD 6 on Python 2.7/3.2
Type: Stage:
Components: IO, Tests Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: neologix, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2011-06-28 11:23 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_io_skip_freebsd.patch vstinner, 2011-06-28 11:38
Messages (4)
msg139355 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-06-28 11:23
test_io.check_interrupted_write() has two threads and a pipe:

 - reader (thread): read one byte from the pipe
 - writer (main thread): write 1 MB into the pipe

An alarm (SIGALRM) is scheduled in one second. The writer blocks because the pipe buffer is smaller than 1 MB, but it is supposed to fill the pipe. The reader is supposed to exit quickly: the writer wrote a least one byte.

The test fails *sometimes* on FreeBSD 6:

[ 85/352] test_io
Exception in thread Thread-274:
Traceback (most recent call last):
  File "/usr/home/db3l/buildarea/3.2.bolen-freebsd/build/Lib/threading.py", line 736, in _bootstrap_inner
    self.run()
  File "/usr/home/db3l/buildarea/3.2.bolen-freebsd/build/Lib/threading.py", line 689, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/home/db3l/buildarea/3.2.bolen-freebsd/build/Lib/test/test_io.py", line 2660, in _read
    s = os.read(r, 1)
OSError: [Errno 4] Interrupted system call

It is a race condition, this buildbot is very slow. The reader has maybe not enough time to read 1 byte.

The test was fixed in Python 3.3 (#11859) by adding pthread_sigmask() (issue #8407) and using it in the test: commit 28b9702a83d1.

The problem looks to be specific of FreeBSD 6 and 7 (according to #11859). The easiest solution is to skip the test on these platforms.

To workaround the lack of pthread_sigmark(), we can use two processes instead of two threads. But it is maybe too much work just to fix a bug in a test (the bug is not in Python).
msg139356 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-06-28 11:38
Patch to skip the test on FreeBSD 5, 6 and 7.

I was unable to reproduce #11859 on my FreeBSD 8 VM, so I didn't add freebsd8.
msg139745 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-04 09:52
New changeset a624b86264a4 by Victor Stinner in branch '2.7':
Issue #12429: Skip interrupted write tests on FreeBSD <= 7
http://hg.python.org/cpython/rev/a624b86264a4

New changeset e924e51e9447 by Victor Stinner in branch '3.2':
Issue #12429: Skip interrupted write tests on FreeBSD <= 7
http://hg.python.org/cpython/rev/e924e51e9447

New changeset 79d7bcbe88f6 by Victor Stinner in branch 'default':
null merge 3.2
http://hg.python.org/cpython/rev/79d7bcbe88f6
msg140054 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-09 08:58
New changeset ad16e4a0ef80 by Victor Stinner in branch '3.2':
Issue #12429: Skip interrupted write tests on FreeBSD <= 7
http://hg.python.org/cpython/rev/ad16e4a0ef80
History
Date User Action Args
2022-04-11 14:57:19adminsetgithub: 56638
2011-07-09 08:58:10python-devsetmessages: + msg140054
2011-07-08 00:36:20vstinnersetstatus: open -> closed
resolution: fixed
2011-07-04 09:52:30python-devsetnosy: + python-dev
messages: + msg139745
2011-06-28 11:38:07vstinnersetfiles: + test_io_skip_freebsd.patch
keywords: + patch
messages: + msg139356
2011-06-28 11:23:47vstinnercreate