Code Review Request 6946825: com.sun.net.httpserver.HttpServer; Memory Leak on Non HTTP conform open socket

Michael McMahon Michael.McMahon at Sun.COM
Thu May 6 09:08:47 PDT 2010


Looks fine.

- Michael.

Chris Hegarty wrote:
> Hi Michael,
>
> The Server implementation keeps a list of HttpConnection instances 
> (which hold SelektionKeyImpl instances) per connection. After 
> accepting a new connection a HttpConnection is created and added to 
> the list. It is never removed if the request turns out to be BAD.
>
> Other instances unnecessarily held as a result of holding the 
> HttpConnection:
>   sun.nio.ch.SocketChannelImpl
>   sun.nio.ch.SelectionKeyImpl
>   java.nio.HeapByteBuffer & [B
>   sun.net.httpserver.Request$WriteStream
>   sun.net.httpserver.Request$ReadStream.
>
> The solution is to remote BAD connections from the list.
>
> Webrev:
>   http://cr.openjdk.java.net/~chegar/6946825/webrev.00/webrev/
>
> Note: There is no regression test for this problem. The fix ( and 
> problem ) was manually verified by looking at a heap histogram.
>
> -Chris.




More information about the net-dev mailing list