[Bug 203162] when close(fd) on a fifo fails with EINTR, the file descriptor is not really closed

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Sep 17 09:33:08 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203162

--- Comment #5 from Victor Stinner <victor.stinner at gmail.com> ---
"The patch would prefer to return success over the EINTR when signal is
delivered while other end of fifo becomes ready simultaneously."

Do you mean that the signal will be delivered later to the application?
Ignoring completly a signal doesn't sound like a good idea :-)

"Note that the patch still does not fix the fundamental underground issue of
the troubles, which is in the test structure itself."

I'm not sure that I understand: do you mean that the test has a race condition?

FYI the Python test suite is executed on a wide range of architectures and
platforms:
http://buildbot.python.org/all/waterfall?category=3.x.stable&category=3.x.unstable

The test_eintr test is executed and pass on Linux, Mac OS X, Solaris (and
OpenIndiana), OpenBSD, etc. For FreeBSD, test_eintr hangs 50% of the time (raw
estimation).

For OpenBSD, I'm not sure, the buildbot is currently disabled. For Mac OS X,
I'm surprised, I thaught that Mac OS X stole a large part of FreeBSD code :-)

Well... I had a lot of trouble to write a reliable C program to reproduce the
issue, so the test may hangs on any platform, but I didn't notice hang (I don't
check _each_ build of each platforms, it would take too much time).

But at least, I can say that the bug fails frequently on FreeBSD, whereas I
never saw it failing on Linux.

"If child reader manages to close fifo before the parent writer sleeping in
open has a chance to run, parent would deadlock, since nothing else would open
the fifo for read."

On Linux, the open(O_RDONLY) in the child blocks until the open(O_WRONLY)
succeed. The Linux kernel looks to ensure that both open succeed "at the time
same".


Short test in Python.

Parent:

$ python3
Python 3.4.2 (default, Jul  9 2015, 17:24:30) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
>>> import os
>>> os.mkfifo("fifo")
>>> f=open("fifo", "wb")
^Z
[1]+  Stoppé                 python3 -q

Child:

haypo at smithers$ python3 
Python 3.4.2 (default, Jul  9 2015, 17:24:30) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
>>> f=open("fifo", "rb")

I used CTRL+z to stop the parent process: the child process hangs until I
restart the parent process (using "fg").

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list