public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Multiple attempts at opening same pipe for writing fail
@ 2018-06-06 16:23 João Eiras
  2018-06-13 18:14 ` Takashi Yano
  0 siblings, 1 reply; 3+ messages in thread
From: João Eiras @ 2018-06-06 16:23 UTC (permalink / raw)
  To: cygwin

Howdy.

I've prepared a testcase for a bug or inconsistency with linux that is
affecting one of my projects.

Basically I have a background process that keeps some state always
running with a pipe open for reading requests.

Foreground processes that try to open that pipe for writting (to send
a request) then block/fail on the second and subsequent tries.

The whole setup can be simplified with a small testcase that runs in a
single process.

https://github.com/joaoe/cygwin-pipe-testcase

I left a README that explains things in a bit more detail.

To summarize here, consider the following order of events:
* open pipe for reading with NONBLOCK into FD1 -> OK
* poll() FD1 -> empty event list, OK
* read from FD1 -> zero length read, OK

* open pipe for writting into FD2, write something -> OK
* poll() FD1 -> POLLIN and POLLPRI, POLLPRI is unexpected here, FAIL
* read from FD1 -> got stuff that was written

* close FD2
* poll() FD1 -> POLLIN and POLLPRI, wrong, should report POLLHUP, FAIL
* read from FD1 -> zero length read, OK

* open pipe for writting into FD2 again -> got error ENXIO, FAIL

So, known bug ? Do you confirm my observations ?

Any pointers so I could perhaps look into the relevant code ? It seems
like Cygwin still keeps some dirty state somewhere that tells the pipe
is still open by a writer somewhere.

Thank you !

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-14 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-06 16:23 Multiple attempts at opening same pipe for writing fail João Eiras
2018-06-13 18:14 ` Takashi Yano
2018-06-14 20:50   ` João Eiras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).