* 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
* Re: Multiple attempts at opening same pipe for writing fail
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
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Yano @ 2018-06-13 18:14 UTC (permalink / raw)
To: cygwin
Hi João,
On Wed, 6 Jun 2018 18:23:08 +0200
João Eiras wrote:
> 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 !
Is this related to https://cygwin.com/ml/cygwin/2017-03/msg00188.html ?
--
Takashi Yano <takashi.yano@nifty.ne.jp>
--
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
* Re: Multiple attempts at opening same pipe for writing fail
2018-06-13 18:14 ` Takashi Yano
@ 2018-06-14 20:50 ` João Eiras
0 siblings, 0 replies; 3+ messages in thread
From: João Eiras @ 2018-06-14 20:50 UTC (permalink / raw)
To: cygwin
On 13 June 2018 at 17:44, Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
> Hi João,
>
> Is this related to https://cygwin.com/ml/cygwin/2017-03/msg00188.html ?
>
Hi.
That seems quite likely.
In my test case, I do open+close+open and the second open fails with
errno.ENXIO.
If I skip the close and do open+open I get the same error.
Next on my TODO list I'll make another testcase just using the Win32
API and see if that is a Windows issue.
--
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).