Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8233958

Memory retention due to HttpsURLConnection finalizer that serves no purpose

XMLWordPrintable

    • b23
    • x86_64
    • windows_10
    • Not verified

        A DESCRIPTION OF THE PROBLEM :
        We have a system that posts lots of (potentially) large messages via HTTPS using a HttpsURLConnections. The underlying HttpURLConnection implementation holds the transmitted data in internal buffers after posting with no way for us to clear them. Normally this would not be an issue because when we release our HttpsURLConnection references the objects would be garbage collected. Unfortunately HttpsURLConnectionImpl exposes a finalizer and so when our system is under load we find that the objects build up in the finalization queue which is only cleared by a low priority thread that does not get to run due to the increased load caused by the garbage collection overhead caused by the low memory state. This then becomes a vicious circle causing the system to become extremely unstable. There have been many bugs raised relating to this area raised in the past, eg: https://bugs.openjdk.java.net/browse/JDK-6869672 and its associated related bugs. The underlying issue of the finalizer never seems to have been addressed but looking at the latest code:

        sun.net.www.protocol.https.HttpsURLConnectionImpl has a finalizer which simply invokes sun.net.www.protocol.https.DelegateHttpsURLConnection.dispose(). This dispose method only invokes super.finalize(). There is no implementation of super.finalize() other than the empty implementation in java.lang.Object and so the finalizer has no purpose and should be removed.



              michaelm Michael McMahon
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: