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

Files appended to bootstrap loader not deleted on exit in Windows

XMLWordPrintable

      If a Java agent appends a file to the bootstrap loader using https://docs.oracle.com/javase/10/docs/api/java/lang/instrument/Instrumentation.html#appendToBootstrapClassLoaderSearch(java.util.jar.JarFile), and if the underlying file is marked for deletion using https://docs.oracle.com/javase/7/docs/api/java/io/File.html#deleteOnExit(), the file is not deleted if using Windows.

      The problem is that the JVM is holding a handle to the file when the deletion routine is running what prevents the file from being deleted.

      This is a problem as many Java agents create temporary files to append classes to the bootstrap loader, thus often polluting the temporary folder of Windows.

            amenkov Alex Menkov
            winterhalter Rafael Winterhalter
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: