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

File leaks in AntClassLoader#findClassInComponents()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      jenkins-2.18
    • Similar Issues:

      Description

      It has been originally reported by Coverity in https://scan5.coverity.com/reports.htm#v36021/p10292/fileInstanceId=97573616&defectInstanceId=28155759&mergedDefectId=1205051. It happens on Exceptional paths only, but actually I see these runaway handlers on my jenkins-2.18 instance. Maybe happens due to plugin dynamic load failure, but I have 31 handlers of such kind.

      #9 /Users/nenashev/Documents/jenkins/test/jenkins-2.16/jenkins/plugins/script-security/WEB-INF/lib/script-security.jar by thread:Loading plugin Job and Slave ownership plugin v0.8 (ownership) on Fri Aug 19 18:48:22 CEST 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:130)
      	at jenkins.util.AntClassLoader.getResourceStream(AntClassLoader.java:798)
      	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1362)
      	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
      	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at jenkins.ClassLoaderReflectionToolkit.invoke(ClassLoaderReflectionToolkit.java:44)
      	at jenkins.ClassLoaderReflectionToolkit._findClass(ClassLoaderReflectionToolkit.java:81)
      	at hudson.ClassicPluginStrategy$DependencyClassLoader.findClass(ClassicPluginStrategy.java:765)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	at jenkins.util.AntClassLoader.findBaseClass(AntClassLoader.java:1398)
      	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1075)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:507)
      	at hudson.PluginManager$2$1$1.run(PluginManager.java:517)
      	at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
      	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
      	at jenkins.model.Jenkins$7.runTask(Jenkins.java:1026)
      	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
      	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/jenkins/util/AntClassLoader.java
          http://jenkins-ci.org/commit/jenkins/67347c3c5f097da968bf8e6fe9fb57b03e358677
          Log:
          [FIXED JENKINS-37561, CID-1205051] - Prevent resource leak in AntClassLoader#findClassInComponents() (#2517)

          It has been originally reported by Coverity in https://scan5.coverity.com/reports.htm#v36021/p10292/fileInstanceId=97573616&defectInstanceId=28155759&mergedDefectId=1205051. It happens on Exceptional paths only, but actually I see 31 runaway handlers on my jenkins-2.18 instance (maybe happens due to plugin dynamic load failure)

          The issue happens, because finally block is misplaced. It handles only the last stream in this cycle

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/jenkins/util/AntClassLoader.java http://jenkins-ci.org/commit/jenkins/67347c3c5f097da968bf8e6fe9fb57b03e358677 Log: [FIXED JENKINS-37561, CID-1205051] - Prevent resource leak in AntClassLoader#findClassInComponents() (#2517) It has been originally reported by Coverity in https://scan5.coverity.com/reports.htm#v36021/p10292/fileInstanceId=97573616&defectInstanceId=28155759&mergedDefectId=1205051 . It happens on Exceptional paths only, but actually I see 31 runaway handlers on my jenkins-2.18 instance (maybe happens due to plugin dynamic load failure) The issue happens, because finally block is misplaced. It handles only the last stream in this cycle
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Fixed it several months ago

          Show
          oleg_nenashev Oleg Nenashev added a comment - Fixed it several months ago

            People

            • Assignee:
              oleg_nenashev Oleg Nenashev
              Reporter:
              oleg_nenashev Oleg Nenashev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: