Web lists-archives.com

Multiple attempts at opening same pipe for writing fail




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