New submission from STINNER Victor <victor.stin...@haypocalc.com>:

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).

----------
components: IO, Tests
messages: 139355
nosy: haypo, neologix
priority: normal
severity: normal
status: open
title: test_io.check_interrupted_write() sporadic failures on FreeBSD 6 on 
Python 2.7/3.2
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12429>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to