SIGPIPE in the GHC runtime

Brian Bloniarz brian.bloniarz at
Wed Aug 18 23:27:24 EDT 2010

On 08/18/2010 07:06 PM, Donn Cave wrote:
> Quoth Brian Bloniarz <brian.bloniarz at>,
> ...
>> I just tested linux in this scenario, it gives EPIPE as I'd expect.
>> Linux's SA_RESTART has been reliable in my limited experience. Do
>> you have an OpenSolaris install to test by any chance? The code is
>> below.
> No, sorry!  But I don't doubt that with the right compile options
> and so forth, that test would work fine on OpenSolaris.  Without
> knowing what really caused the problem I mentioned, I can't guess
> how to duplicate the problem or test for it.  (Cf. "hGetContents:
> resource exhausted", Haskell Cafe, lally.singh at  I know
> that's rather unhelpful.  I hate unnecessary signals.

Thanks for the pointer! I can try to dig around, but yeah I'd be
tempted to just hope for the best given that the patch I posted
won't make matters worse.

> A less elegant variaton on that would be to block SIGPIPE, instead
> of ignoring it.  I don't have a great deal of practical experience
> with that, nor have I looked at how it would fit with GHC runtime
> code, but execve(2) does reset the signal mask, so it would have
> the inheritance properties you want.

I think the signal mask is retained across exec (!).
Search for "the new process will inherit"; experimentally, linux
retains it.


More information about the Glasgow-haskell-users mailing list