Ticket #12 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Bug in network library, uncaught exception when dealing with ipv6 sockets

Reported by: tibbe Owned by: bos
Priority: major Milestone:
Component: network Version:
Keywords: Cc: tphyahoo@…


There is an uncaught exception in the network library which is causing my HAppS demo website


to crash every couple of days. This has affected other people using HAppS as well, as described on postings to the HAppS users list.

The bug, and workarounds, is described at


Initially reported patch at


Patch is attached.

The bug seems legitimate. Thanks for reporting it. The patch is a bit crufty, so I'll work something cleaner up.

Yes, not a very good patch I agree. I had an uncaught exception error a couple of days after I implemented.

Anyway, here's a tweaked patch, which at least fixes that.

<  (Just peer, _) <- getNameInfo [] True False addr
>  (Just peer) <-
>     catchIO ( return . fst =<< getNameInfo [] True False addr )
>             (\e -> case addr of
>                      SockAddrInet port haddr -> return . Just =<< inet_ntoa haddr
>                      SockAddrInet6 port flow haddr6 scope -> return . Just . show $ haddr6
>                      SockAddrUnix x -> return . Just $ x
>             )

Also, for what it's worth, a quick and dirty fix which at least keeps happs apps from dying is simply to turn off ipv6 support like so:

diff -rN old-network- new-network-
> # /* define IPV6_SOCKET_SUPPORT 1 */

FWIW, I think liftM fst is clearer than return . fst =<<.

Moved from http://hackage.haskell.org/trac/ghc/ticket/2927

Change History

Changed 8 years ago by bos

  • status changed from new to closed
  • resolution set to fixed

Fixed in darcs.

Note: See TracTickets for help on using tickets.