GHCI crashes without error message

Lemmih lemmih at gmail.com
Wed Apr 27 12:46:39 EDT 2005


On 4/27/05, Robert van Herk <rherk at cs.uu.nl> wrote:
> It seems that the problem of the spontanious crash in ghci, without an
> error message, occurs because I use a wrong buffering strategy on a handle:
> 
> When I include the line
>   hSetBuffering handle LineBuffering
> in my program, the program crashes at random moments, without error
> messages. When I comment it out, it works ok. The handle in the above
> example is a socket. My program is a web server.

>From the Network documentation
(http://haskell.org/ghc/docs/latest/html/libraries/network/Network.html):
"
SIGPIPE

On Unix, when reading from a socket and the writing end is closed by
the remote client, the program is normally sent a SIGPIPE signal by
the operating system. The default behaviour when a SIGPIPE is received
is to terminate the program silently, which can be somewhat confusing
if you haven't encountered this before. The solution is to specify
that SIGPIPE is to be ignored, using the POSIX library:

  import Posix
  main = do installHandler sigPIPE Ignore Nothing; ...
"

-- 
Friendly,
  Lemmih


More information about the Glasgow-haskell-users mailing list