Uploaded image for project: 'PUBLIC - Liferay BLADE'
  1. PUBLIC - Liferay BLADE
  2. BLADE-611

Classloaders Keeping Jar Files Open

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0.5
    • Fix Version/s: 4.0.6
    • Component/s: blade-cli
    • Labels:
      None

      Description

      Blade can not delete the jar files opened by URLClassLoader.
      can be reproduced on Windows and MacOS now.

      It will throw a FileSystemException:

      Unexpected error occured.
      java.nio.file.FileSystemException: C:\Users\liferay\AppData\Local\Temp\extensions5688047344730809452\com.liferay.blade.extensions.maven.profile-1.0.22.jar: The process cannot access the file because it is being used by another process.
      
              at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
              at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
              at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
              at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
              at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
              at java.nio.file.Files.delete(Unknown Source)
              at com.liferay.blade.cli.util.FileUtil$1.visitFile(FileUtil.java:107)
              at com.liferay.blade.cli.util.FileUtil$1.visitFile(FileUtil.java:86)
              at java.nio.file.Files.walkFileTree(Unknown Source)
              at java.nio.file.Files.walkFileTree(Unknown Source)
              at com.liferay.blade.cli.util.FileUtil.deleteDir(FileUtil.java:84)
              at com.liferay.blade.cli.util.FileUtil.deleteDirIfExists(FileUtil.java:135)
              at com.liferay.blade.cli.ExtensionsClassLoaderSupplier.close(ExtensionsClassLoaderSupplier.java:61)
              at com.liferay.blade.cli.BladeCLI.run(BladeCLI.java:644)
              at com.liferay.blade.cli.BladeCLI.main(BladeCLI.java:133)
      
      

      these three jar files can not be deleted:
      com.liferay.blade.extensions.maven.profile-1.0.22.jar
      com.liferay.project.templates.js.theme-1.0.5.jar
      com.liferay.project.templates.js.widget-1.0.5.jar

      helpful links:
      http://management-platform.blogspot.com/2009/01/classloaders-keeping-jar-files-open.html
      https://stackoverflow.com/questions/1771679/difference-between-threads-context-class-loader-and-normal-classloader
      https://snipplr.com/view/24224/class-loader-which-close-opened-jar-files

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              seiphon.wang Seiphon Wang
              Reporter:
              seiphon.wang Seiphon Wang
              Participants of an Issue:
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Packages

                  Version Package
                  4.0.6