Exceptions and sockets

Volker Stolz stolz@I2.Informatik.RWTH-Aachen.DE
Wed, 2 May 2001 15:40:37 +0200

In local.glasgow-haskell-users, you wrote:
>I `Socket.accept' a connection and get a handle.
>Now, if the connections dies, but I still write to the handle,
>the whole thing crashes - without throwing an exception.
>(I checked that the RTS thinks  `hIsWritable h'
>even if `h' does no longer exist in reality.)

Looks to me like you're forgetting that the OS will give you a
sigPIPE on (semi-)closed sockets, which translates to a segfault
unless you install a signal handler:

 - http://www.haskell.org/ghc/docs/latest/set/socket.html#AEN13989
 - socket(2)
Abstrakte Syntaxträume.
Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME