Problems with openFd and -threaded

Bryan O'Sullivan bos at serpentine.com
Tue Nov 30 06:57:45 CET 2010


On Mon, Nov 29, 2010 at 9:49 PM, wren ng thornton <wren at freegeek.org> wrote:

> 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".
>

Actually, this happens all the time if you're calling a system call that
isn't already wrapped for you, and the behaviour is expected: you absolutely
must expect, and deal with, EINTR. Here's an example:
http://www.serpentine.com/blog/2010/09/04/dealing-with-fragile-c-libraries-e-g-mysql-from-haskell/

Are you using System.Posix.IO.openFD? The check for EINTR wasn't added to
the unix package until January of this year, so perhaps the version of GHC
or the unix package that you're using is too old to contain the fix?


> N.B., the call to openFd in question is from the main thread and before any
> STM or forkIO shenanigans.


That doesn't matter. Once the threaded RTS starts, it's going to send your
program SIGVTALRM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20101130/85c88bcf/attachment.html


More information about the Glasgow-haskell-users mailing list