6946825: com.sun.net.httpserver.HttpServer; Memory Leak on Non HTTP conform open socket
authorchegar
Thu, 06 May 2010 17:17:09 +0100
changeset 5463 ad2d35ddcf37
parent 5462 cb614e59f7f9
child 5464 8c4deb1b4a45
6946825: com.sun.net.httpserver.HttpServer; Memory Leak on Non HTTP conform open socket Reviewed-by: michaelm
jdk/src/share/classes/sun/net/httpserver/ServerImpl.java
--- a/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java	Thu May 06 13:42:52 2010 +0800
+++ b/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java	Thu May 06 17:17:09 2010 +0100
@@ -451,6 +451,7 @@
                 if (requestLine == null) {
                     /* connection closed */
                     connection.close();
+                    allConnections.remove(connection);
                     return;
                 }
                 int space = requestLine.indexOf (' ');
@@ -592,6 +593,8 @@
             sendReply (
                 code, true, "<h1>"+code+Code.msg(code)+"</h1>"+message
             );
+            /* connection is already closed by sendReply, now remove it */
+            allConnections.remove(connection);
         }
 
         void sendReply (