RE: Yet another weakly defined bug report

You should do the counting strictly:
Just n -> case n+1 of n1 -> addToFM f w n1
Careful - that case expression doesn't actually force n to be evaluated. It's exactly equivalent to let n1 = n+1 in addToFM f w n1 You need to use seq to force evaluation. Cheers, Simon

Previous 5.04 releases had an exception handler missing from connectTo that results in a socket leaking if socketToHandle fails for some reason (I cant remember the exact circumstances at the moment, but it causes a server to die - I think the leak is caused when the client closes the connection during the handshake - ie somebody presses stop on a web browser because of a slow connection after the handshake has just started) - I suggested a fix along the lines of: connectTo hostname (Service serv) = do proto <- getProtocolNumber "tcp" port <- getServicePortNumber serv he <- getHostByName hostname sock <- socket AF_INET Stream proto (do connect sock (SockAddrInet port (hostAddress he)) socketToHandle sock ReadWriteMode) `Control.Exception.catch` (\e -> do sClose sock; throw e) This seems to be missing from 5.04.3 - this fix is important for reliability in a production server, what happened - does this cause problems in other places? Regards, Keean Schupke.

this bug is also a showstopper for a pretty big project I am working on. lets make sure it doesn't fall through the cracks. John On Wed, Mar 12, 2003 at 09:06:59AM +0000, Keean Schupke wrote:
Previous 5.04 releases had an exception handler missing from connectTo that results in a socket leaking if socketToHandle fails for some reason (I cant remember the exact circumstances at the moment, but it causes a server to die - I think the leak is caused when the client closes the connection during the handshake - ie somebody presses stop on a web browser because of a slow connection after the handshake has just started) - I suggested a fix along the lines of:
connectTo hostname (Service serv) = do proto <- getProtocolNumber "tcp" port <- getServicePortNumber serv he <- getHostByName hostname sock <- socket AF_INET Stream proto (do connect sock (SockAddrInet port (hostAddress he)) socketToHandle sock ReadWriteMode) `Control.Exception.catch` (\e -> do sClose sock; throw e)
This seems to be missing from 5.04.3 - this fix is important for reliability in a production server, what happened - does this cause problems in other places?
Regards, Keean Schupke.
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
-- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net ---------------------------------------------------------------------------

The fix for duplex handle finalizers ... where GHC.Handle has the finalizer attached to the read side addMVarFinalizer read_side (handleFinalizer read_side), and it should be on the write side (as the read side points to the write side using haOther...) Without this fix hGetContents leaks file handles... Keean Schupke
participants (3)
-
John Meacham
-
Keean Schupke
-
Simon Marlow