Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 2015 13:43:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 203162] when close(fd) on a fifo fails with EINTR, the file descriptor is not really closed
Message-ID:  <bug-203162-8-GpofSB5LDc@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-203162-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-203162-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203162

--- Comment #6 from Konstantin Belousov <kib@FreeBSD.org> ---
(In reply to Victor Stinner from comment #5)
FreeBSD also ensures that both open(O_RDONLY) and open(O_WRONLY) succeed
simultaneously, but there is a race.

Assume that both threads doing the opens noticed each other presence, but right
after that the thread doing open(O_RDONLY) continued execution, while the
thread doing(O_WRONLY) was not put on the CPU immediately.  It was a scheduler
decision, for whatever reasons.  Then, open(O_RDONLY) succeeds, the thread
continues the execution and then it could even run as far as to execute close()
on the fd returned by open.  After that, when open(O_WRONLY) thread eventually
gets CPU, it notices that there is no readers (there was one, but it is gone
now).  So it returns to the sleep waiting for a reader.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-203162-8-GpofSB5LDc>