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

Allow per protocol setting for URLConnection defaultUseCaches

    Details

    • Subcomponent:
    • Resolved In Build:
      b153
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      ava version "1.8.0_112-ea"
      ava(TM) SE Runtime Environment (build 1.8.0_112-ea-b04)
      ava HotSpot(TM) 64-Bit Server VM (build 25.112-b04, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      The default behavior of URLConnection is to use caching. This can cause file descriptor leaks / locked files when using JarURLConnection.

      My suggestion is that the constructor for JarURLConnection be modified to change the default for useCaches to false for JarURLConnection instances.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      https://github.com/markt-asf/memory-leaks/blob/master/src/org/apache/markt/leaks/net/JarUrlConnectionLeak.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The temporary JAR file is deleted by the test.
      ACTUAL -
      The JAR cannot be deleted until the JVM exits.

      FAIL: [C:\Users\ADMINI~1\AppData\Local\Temp\testJar6646122445884823355.jar] could not be deleted

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      https://github.com/markt-asf/memory-leaks/blob/master/src/org/apache/markt/leaks/net/JarUrlConnectionLeak.java
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Disable caching before using JarUrlConnection

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michaelm Michael McMahon
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: