[Mono-dev] fix for bug #358987 in 1.9?

Steve Bjorg steveb at mindtouch.com
Wed Feb 20 09:48:03 EST 2008


Could someone make sure that the proposed patch gets applied to 1.9?
https://bugzilla.novell.com/show_bug.cgi?id=358987

Since applying it to our server (1.2.6), we've seen uptime for 12  
days compared to less than 24 hrs before.

The fix is merely to put a try...catch around the statement that  
closes the sockets even when shutdown fails (which it does when only  
1 side of the socket is closed as in an abandoned connection).   
Failing to close the socket causes a leak and eventually kills the  
process as it runs out of file handles.

Index: HttpConnection.cs
===================================================================
--- HttpConnection.cs	(revision 94904)
+++ HttpConnection.cs	(working copy)
@@ -313,7 +313,11 @@

  				Socket s = sock;
  				sock = null;
-				s.Shutdown (SocketShutdown.Both);
+				try {
+					s.Shutdown (SocketShutdown.Both);
+				} catch(Exception e) {
+					// log here?
+				}
  				s.Close ();
  				if (context_bound)
  					epl.UnbindContext (context);

The pushback has been that this problem should be solved upstream,  
but this is a SAFE fix.  Regardless of the implementation of Shutdown 
(), Close() MUST be called to release resources associated with the  
socket.

PLEASE add this fix to 1.9.  Thanks.


- Steve

---------------------------------
Steve G. Bjorg

MindTouch
555 W. Beech St.
Suite 501
San Diego, CA 92101

619.795.8459x1106 office
619.795.3948 fax
425.891.5913 mobile



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080220/077a2b0e/attachment-0001.html 


More information about the Mono-devel-list mailing list