FreeBSD + FIFO pipes

George Russell ger@tzi.de
Wed, 19 Feb 2003 17:40:30 +0100


Volker Stolz wrote:> In local.glasgow-haskell-users, you wrote:
> 
>>I'm trying to get HTk to work on FreeBSD (actually FreeBSD running inside a VMware
>>virtual machine, but I don't think that should make any difference).  How HTk works
>>is it creates a couple of pipes
>>       (readIn,writeIn) <- Posix.createPipe
>>       (readOut,writeOut) <- Posix.createPipe
>>The problem I am getting with FreeBSD is that fdRead sometimes reports EOF, even though
>>threadWaitRead has just reported the presence of data.  (And no, I don't think we have
>>a race condition here, the relevant bit of code is in an exclusive lock.)  If I tell it
>>to ignore the EOF and try to read again and again it just throws it into an endless loop,
>>seemingly.
> 
> 
> Can you cut this down to a simple program, maybe executing /bin/echo
> instead of 'wish'? Notice that the FAQ doesn't apply here as the FAQ
> talks about FIFO createt by mkfifo (which exist in the file system),
> while you talk about pipes.
> 
> I'll try to think of something, but I'd be glad if you already
> had a usable program to reproduce this error.
I think this one is going to remain unsolved.  I have fixed the problem, by reimplementing
the relevant code in a different way (actually resurrecting an old implementation, with
a vital fix) and now it works.  However the cause of the problem I reported is a mystery
to me, and producing a simple test case does not look very easy.

Thanks for your help,

George