Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40621

MavenEmbedderUtils#getMavenVersion() leaks file descriptors

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • maven-plugin
    • None

      Maven Plugin and Artifactory Plugin are affected.

      Such descriptor leaks, for example, prevent change of the Maven tool version on Windows.

      The fix is required here: https://github.com/jenkinsci/lib-jenkins-maven-embedder/blob/master/src/main/java/hudson/maven/MavenEmbedderUtils.java#L186-L213 . This library is included directly into the Maven plugin, hence it should be possible to do it. The only problem is that there are several unreleased changes in libs since 2013s. Should be "safe" after the quick look

      #553 /Users/nenashev/Documents/...
      /hudson.tasks.Maven_MavenInstallation/M3/lib/commons-lang-2.6.jar by thread:Executor #1 for master : executing MyMvnBuild #1 on Thu Dec 22 09:18:49 CET 2016
      at java.util.zip.ZipFile.<init>(ZipFile.java:151)
      at java.util.jar.JarFile.<init>(JarFile.java:166)
      at java.util.jar.JarFile.<init>(JarFile.java:103)
      at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:893)
      at sun.misc.URLClassPath$JarLoader.access$700(URLClassPath.java:756)
      at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:838)
      at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:831)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:830)
      at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:803)
      at sun.misc.URLClassPath$3.run(URLClassPath.java:530)
      at sun.misc.URLClassPath$3.run(URLClassPath.java:520)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.misc.URLClassPath.getLoader(URLClassPath.java:519)
      at sun.misc.URLClassPath.getLoader(URLClassPath.java:492)
      at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:457)
      at sun.misc.URLClassPath.findResource(URLClassPath.java:187)
      at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
      at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.findResource(ClassRealm.java:281)
      at hudson.maven.MavenEmbedderUtils.getMavenVersion(MavenEmbedderUtils.java:196)
      at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:69)
      at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:41)
      at hudson.FilePath.act(FilePath.java:1083)
      at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:642)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      at hudson.model.Run.execute(Run.java:1729)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:404)
      

          [JENKINS-40621] MavenEmbedderUtils#getMavenVersion() leaks file descriptors

          Fixed in 2.15

          Arnaud Héritier added a comment - Fixed in 2.15

          Oleg Nenashev added a comment -

          aheritier should we also bump the dependnecy on maven-plugin in the Artifactory plugin?
          I suppose we can leave it as is since the issue is not severe

          Oleg Nenashev added a comment - aheritier should we also bump the dependnecy on maven-plugin in the Artifactory plugin? I suppose we can leave it as is since the issue is not severe

          oleg_nenashev JFrog doesn't manage their issues in this Jira (https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin)
          What I will do is to create an issue to trace it in https://www.jfrog.com/jira/projects/HAP

          Arnaud Héritier added a comment - oleg_nenashev JFrog doesn't manage their issues in this Jira ( https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin ) What I will do is to create an issue to trace it in https://www.jfrog.com/jira/projects/HAP

          Oleg Nenashev added a comment -

          The original fix does not actually work from what I see

          Oleg Nenashev added a comment - The original fix does not actually work from what I see

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/hudson/maven/MavenEmbedderUtils.java
          http://jenkins-ci.org/commit/lib-jenkins-maven-embedder/069e84ea912e43afc99c9b8c69c79abbdd0967c7
          Log:
          JENKINS-40621 - Close classRealm after reading the files

          After it it stops leaking the files… on my machine

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/maven/MavenEmbedderUtils.java http://jenkins-ci.org/commit/lib-jenkins-maven-embedder/069e84ea912e43afc99c9b8c69c79abbdd0967c7 Log: JENKINS-40621 - Close classRealm after reading the files After it it stops leaking the files… on my machine

          Code changed in jenkins
          User: Olivier Lamy
          Path:
          pom.xml
          src/main/java/hudson/maven/MavenEmbedderCallable.java
          src/main/java/hudson/maven/MavenEmbedderUtils.java
          src/test/java/hudson/maven/TestMavenEmbedderUtils.java
          http://jenkins-ci.org/commit/lib-jenkins-maven-embedder/9229e4be5d5d3667de6ae97161f09596826c6798
          Log:
          Merge pull request #13 from oleg-nenashev/JENKINS-42549

          [JENKINS-42549, JENKINS-40621] - Handle fallout after #5

          Compare: https://github.com/jenkinsci/lib-jenkins-maven-embedder/compare/bcac0b5bd889...9229e4be5d5d

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier Lamy Path: pom.xml src/main/java/hudson/maven/MavenEmbedderCallable.java src/main/java/hudson/maven/MavenEmbedderUtils.java src/test/java/hudson/maven/TestMavenEmbedderUtils.java http://jenkins-ci.org/commit/lib-jenkins-maven-embedder/9229e4be5d5d3667de6ae97161f09596826c6798 Log: Merge pull request #13 from oleg-nenashev/ JENKINS-42549 [JENKINS-42549, JENKINS-40621] - Handle fallout after #5 Compare: https://github.com/jenkinsci/lib-jenkins-maven-embedder/compare/bcac0b5bd889...9229e4be5d5d

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          pom.xml
          http://jenkins-ci.org/commit/maven-plugin/8983583f2ed58734da3edd1b72428476bcd1a5a9
          Log:
          [JENKINS-42549, JENKINS-40621] - Update the Maven Embedder Lib to 3.12.1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: pom.xml http://jenkins-ci.org/commit/maven-plugin/8983583f2ed58734da3edd1b72428476bcd1a5a9 Log: [JENKINS-42549, JENKINS-40621] - Update the Maven Embedder Lib to 3.12.1

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          pom.xml
          http://jenkins-ci.org/commit/maven-plugin/c068c94037bc76172b682175878dbdd4c01f163a
          Log:
          [JENKINS-42549, JENKINS-40621] - Update the Maven Embedder Lib to 3.12.1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: pom.xml http://jenkins-ci.org/commit/maven-plugin/c068c94037bc76172b682175878dbdd4c01f163a Log: [JENKINS-42549, JENKINS-40621] - Update the Maven Embedder Lib to 3.12.1

          Oleg Nenashev added a comment -

          The fix has been released in Maven Plugin 2.17 and Maven Embedder Lib 3.12.1

          Oleg Nenashev added a comment - The fix has been released in Maven Plugin 2.17 and Maven Embedder Lib 3.12.1

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          src/main/java/hudson/maven/MavenEmbedderUtils.java
          http://jenkins-ci.org/commit/lib-jenkins-maven-embedder/a1d7a99605ca6b8f7d79498a3d0d4891656a8b0c
          Log:
          Merge pull request #5 from abayer/jenkins-40621

          [FIXED JENKINS-40621] Prevent leaked file descriptors.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/hudson/maven/MavenEmbedderUtils.java http://jenkins-ci.org/commit/lib-jenkins-maven-embedder/a1d7a99605ca6b8f7d79498a3d0d4891656a8b0c Log: Merge pull request #5 from abayer/jenkins-40621 [FIXED JENKINS-40621] Prevent leaked file descriptors.

            oleg_nenashev Oleg Nenashev
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: