RE: fix missing from 5.04.3 ???

2003-03-14 Thread Simon Marlow
 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)

Sorry, that one didn't get merged into 5.04.x.  An oversight on my part.

You can work around the problem by using your own implementation of
connectTo, or copying the one from Network.hs in CVS.

Cheers,
Simon
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


fix missing from 5.04.3 ???

2003-03-12 Thread Keean Schupke
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
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users