Ticket #12 (closed defect: fixed)
Bug in network library, uncaught exception when dealing with ipv6 sockets
|Reported by:||tibbe||Owned by:||bos|
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-22.214.171.124/Network.hs new-network-126.96.36.199/Network.hs 22c22 < #define IPV6_SOCKET_SUPPORT 1 --- > # /* define IPV6_SOCKET_SUPPORT 1 */
FWIW, I think liftM fst is clearer than return . fst =<<.