Problems with openFd and -threaded

Simon Marlow marlowsd at
Tue Nov 30 17:05:43 CET 2010

On 30/11/10 05:49, wren ng thornton wrote:
> On 11/29/10 6:36 PM, Bryan O'Sullivan wrote:
>> On Sat, Nov 27, 2010 at 9:05 PM, wren ng thornton<wren at>
>> wrote:
>>> So I've just started playing around with STM and -threaded programs and
>>> I've run into a bug. The bug is similar to [1] except that the file in
>>> question is a Posix FIFO instead of a Bluetooth device. Same behavior:
>>> always errors with -threaded, but expected behavior when not -threaded
>>> (i.e., blocks until another process opens the other end of the FIFO).
>>> GHC
>>> version is 6.12.1.
>> Isn't that pretty normal?
> The blocking for someone to open the other end is perfectly normal. The
> fact that compiling with -threaded takes a perfectly working program and
> makes it consistently crash I wouldn't call "normal".
> N.B., the call to openFd in question is from the main thread and before
> any STM or forkIO shenanigans.
>> Just retry if you get EINTR, that's what
>> throwErrnoIfMinus1 and friends are for:
> I'll see if I can make a workaround with that, but as I said: Simon's
> already confirmed that this is a bug, I'm just looking for a ticket
> number or a version where it's fixed.

And fix it I did:

Wed Jan 27 11:46:00 GMT 2010  Simon Marlow <marlowsd at>
   * check for EINTR in openFd

     M ./System/Posix/Error.hs -2 +26
     M ./System/Posix/IO.hsc -1 +1

The fix is in unix-, which comes with GHC 7.0.1.


More information about the Glasgow-haskell-users mailing list