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

Warnings trend chart does not appear; duplicate classes in echarts-api.jar and echarts-build-trends-2.0.0.jar in ECharts API Plugin

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • echarts-api-plugin
    • None

      On the web page of a branch of a multibranch project, the warnings trend chart does not render. Instead, there is a placeholder with a progress ring and the text "loading". The developer tools in the Web browser show HTTP status 500 from a POST /jenkins/$stapler/bound/6d08ec1b-ebf8-4765-ad4e-b89a4089ea71/getBuildTrendModel request, and the Jenkins log shows various exceptions, depending on plugin and JVM versions and perhaps other things:

      • java.lang.NoClassDefFoundError: edu/hm/hafner/echarts/LineSeries
      • java.lang.LinkageError: edu.hm.hafner.echarts.LineSeries
      • java.lang.LinkageError: A duplicate class definition for edu/hm/hafner/echarts/JacksonFacade is found
      • java.lang.LinkageError: loader (instance of hudson/ClassicPluginStrategy$AntClassLoader2): attempted duplicate class definition for name: "edu/hm/hafner/echarts/JacksonFacade"

      The classes edu.hm.hafner.echarts.LineSeries and edu.hm.hafner.echarts.JacksonFacade are defined in both plugins/echarts-api/WEB-INF/lib/echarts-api.jar and plugins/echarts-api/WEB-INF/lib/echarts-build-trends-2.0.0.jar. Those jar files are included in plugins/echarts-api.jpi (ECharts API Plugin 5.0.1-1). This seems to be a bug in that plugin, then.

      $ unzip -l plugins/echarts-api/WEB-INF/lib/echarts-build-trends-2.0.0.jar
      Archive:  plugins/echarts-api/WEB-INF/lib/echarts-build-trends-2.0.0.jar
        Length      Date    Time    Name
      ---------  ---------- -----   ----
            221  2020-05-13 01:12   META-INF/MANIFEST.MF
              0  2020-05-13 01:12   META-INF/
              0  2020-05-13 01:12   edu/
              0  2020-05-13 01:12   edu/hm/
              0  2020-05-13 01:12   edu/hm/hafner/
              0  2020-05-13 01:12   edu/hm/hafner/echarts/
              0  2020-05-13 01:12   META-INF/maven/
              0  2020-05-13 01:12   META-INF/maven/edu.hm.hafner/
              0  2020-05-13 01:12   META-INF/maven/edu.hm.hafner/echarts-build-trends/
           1287  2020-05-13 01:12   edu/hm/hafner/echarts/ChartModelConfiguration.class
           2914  2020-05-13 01:12   edu/hm/hafner/echarts/LineSeries.class
          13228  2020-05-13 01:12   edu/hm/hafner/echarts/SeriesBuilder.class
           4002  2020-05-13 01:12   edu/hm/hafner/echarts/LinesDataSet.class
           2313  2020-05-13 01:12   edu/hm/hafner/echarts/Palette.class
           2168  2020-05-13 01:12   edu/hm/hafner/echarts/ResultTime.class
            976  2020-05-13 01:12   edu/hm/hafner/echarts/BuildResult.class
           2743  2020-05-13 01:12   edu/hm/hafner/echarts/LinesChartModel.class
           1247  2020-05-13 01:12   edu/hm/hafner/echarts/ChartModelConfiguration$AxisType.class
           3454  2020-05-13 01:12   edu/hm/hafner/echarts/PercentagePieChart.class
            283  2020-05-13 01:12   edu/hm/hafner/echarts/package-info.class
           1490  2020-05-13 01:12   edu/hm/hafner/echarts/PieData.class
           1689  2020-05-13 01:12   edu/hm/hafner/echarts/PieChartModel.class
           1917  2020-05-13 01:12   edu/hm/hafner/echarts/LocalDateLabel.class
           2111  2020-05-13 01:12   edu/hm/hafner/echarts/Build.class
           1073  2020-05-13 01:12   edu/hm/hafner/echarts/JacksonFacade.class
            579  2020-05-13 01:12   edu/hm/hafner/echarts/AreaStyle.class
            485  2020-05-13 01:12   edu/hm/hafner/echarts/ItemStyle.class
           1176  2020-05-13 01:12   edu/hm/hafner/echarts/LineSeries$StackedMode.class
           1159  2020-05-13 01:12   edu/hm/hafner/echarts/LineSeries$FilledMode.class
           1496  2020-05-13 01:12   edu/hm/hafner/echarts/TimeFacade.class
           4969  2020-05-13 01:12   META-INF/maven/edu.hm.hafner/echarts-build-trends/pom.xml
             68  2020-05-13 01:12   META-INF/maven/edu.hm.hafner/echarts-build-trends/pom.properties
      ---------                     -------
          53048                     32 files
      
      $ unzip -l plugins/echarts-api/WEB-INF/lib/echarts-api.jar
      Archive:  plugins/echarts-api/WEB-INF/lib/echarts-api.jar
        Length      Date    Time    Name
      ---------  ---------- -----   ----
              0  2021-03-03 18:04   META-INF/
            808  2021-03-03 18:04   META-INF/MANIFEST.MF
              0  2021-03-03 18:04   edu/
              0  2021-03-03 18:04   edu/hm/
              0  2021-03-03 18:04   edu/hm/hafner/
              0  2021-03-03 18:04   edu/hm/hafner/echarts/
              0  2021-03-03 18:04   io/
              0  2021-03-03 18:04   io/jenkins/
              0  2021-03-03 18:04   io/jenkins/plugins/
              0  2021-03-03 18:04   io/jenkins/plugins/echarts/
              0  2021-03-03 18:04   charts/
           1287  2020-05-13 01:12   edu/hm/hafner/echarts/ChartModelConfiguration.class
           2914  2020-05-13 01:12   edu/hm/hafner/echarts/LineSeries.class
          13228  2020-05-13 01:12   edu/hm/hafner/echarts/SeriesBuilder.class
           4002  2020-05-13 01:12   edu/hm/hafner/echarts/LinesDataSet.class
           2313  2020-05-13 01:12   edu/hm/hafner/echarts/Palette.class
           2168  2020-05-13 01:12   edu/hm/hafner/echarts/ResultTime.class
            976  2020-05-13 01:12   edu/hm/hafner/echarts/BuildResult.class
           2743  2020-05-13 01:12   edu/hm/hafner/echarts/LinesChartModel.class
           1247  2020-05-13 01:12   edu/hm/hafner/echarts/ChartModelConfiguration$AxisType.class
           3454  2020-05-13 01:12   edu/hm/hafner/echarts/PercentagePieChart.class
            283  2020-05-13 01:12   edu/hm/hafner/echarts/package-info.class
           1490  2020-05-13 01:12   edu/hm/hafner/echarts/PieData.class
           1689  2020-05-13 01:12   edu/hm/hafner/echarts/PieChartModel.class
           1917  2020-05-13 01:12   edu/hm/hafner/echarts/LocalDateLabel.class
           2111  2020-05-13 01:12   edu/hm/hafner/echarts/Build.class
           1073  2020-05-13 01:12   edu/hm/hafner/echarts/JacksonFacade.class
            579  2020-05-13 01:12   edu/hm/hafner/echarts/AreaStyle.class
            485  2020-05-13 01:12   edu/hm/hafner/echarts/ItemStyle.class
           1176  2020-05-13 01:12   edu/hm/hafner/echarts/LineSeries$StackedMode.class
           1159  2020-05-13 01:12   edu/hm/hafner/echarts/LineSeries$FilledMode.class
           1496  2020-05-13 01:12   edu/hm/hafner/echarts/TimeFacade.class
            877  2021-03-03 18:04   io/jenkins/plugins/echarts-common.jelly
            863  2021-03-03 18:04   io/jenkins/plugins/echarts.jelly
           3815  2021-03-03 18:04   io/jenkins/plugins/echarts/BuildActionIterator.class
           3078  2021-03-03 18:04   io/jenkins/plugins/echarts/AsyncTrendJobAction.class
           2209  2021-03-03 18:04   io/jenkins/plugins/echarts/BuildActionIterator$ActionSelector.class
            307  2021-03-03 18:04   io/jenkins/plugins/echarts/AsyncTrendChart.class
            877  2021-03-03 18:04   io/jenkins/plugins/echarts-simple.jelly
              0  2021-03-03 18:04   charts/taglib
           1485  2021-03-03 18:04   charts/trend-chart.jelly
           1476  2021-03-03 18:04   charts/pie-chart.jelly
           1373  2021-03-03 18:04   charts/progress-chart.jelly
              0  2021-03-03 18:04   META-INF/maven/
              0  2021-03-03 18:04   META-INF/maven/io.jenkins.plugins/
              0  2021-03-03 18:04   META-INF/maven/io.jenkins.plugins/echarts-api/
           5608  2021-03-03 18:04   META-INF/maven/io.jenkins.plugins/echarts-api/pom.xml
            116  2021-03-03 18:04   META-INF/maven/io.jenkins.plugins/echarts-api/pom.properties
      ---------                     -------
          70682                     48 files
      

          [JENKINS-65261] Warnings trend chart does not appear; duplicate classes in echarts-api.jar and echarts-build-trends-2.0.0.jar in ECharts API Plugin

          Ivan Kurnosov added a comment -

          I have the same files

          jenkins@jenkins-59f6b58798-z4r8z:~/plugins/echarts-api/WEB-INF/lib$ ls -la
          total 11036
          drwxrwsr-x 2 jenkins jenkins     4096 Apr  8 06:56 .
          drwxrwsr-x 3 jenkins jenkins     4096 Apr  8 06:56 ..
          -rw-rw-r-- 1 jenkins jenkins    35954 Apr  7 14:25 echarts-api.jar
          -rw-rw-r-- 1 jenkins jenkins 10019815 Dec  5  2018 eclipse-collections-9.2.0.jar
          -rw-rw-r-- 1 jenkins jenkins  1231986 Dec  5  2018 eclipse-collections-api-9.2.0.jar
          
          

          But it looks like you were right: this instance runs in kubernetes, and after plugins are updated - it performs the "restart" but apparently it's some sort of "soft" restart (not sure about the proper terminology), when the main jenkins process does not fully unload from memory, but instead simply reinitialises its resources.

          Nevertheless, fully shutting down and restarting a jenkins process (effectively - killing the pod) helped, thanks a lot!

          Ivan Kurnosov added a comment - I have the same files jenkins@jenkins-59f6b58798-z4r8z:~/plugins/echarts-api/WEB-INF/lib$ ls -la total 11036 drwxrwsr-x 2 jenkins jenkins 4096 Apr 8 06:56 . drwxrwsr-x 3 jenkins jenkins 4096 Apr 8 06:56 .. -rw-rw-r-- 1 jenkins jenkins 35954 Apr 7 14:25 echarts-api.jar -rw-rw-r-- 1 jenkins jenkins 10019815 Dec 5 2018 eclipse-collections-9.2.0.jar -rw-rw-r-- 1 jenkins jenkins 1231986 Dec 5 2018 eclipse-collections-api-9.2.0.jar But it looks like you were right: this instance runs in kubernetes, and after plugins are updated - it performs the "restart" but apparently it's some sort of "soft" restart (not sure about the proper terminology), when the main jenkins process does not fully unload from memory, but instead simply reinitialises its resources. Nevertheless, fully shutting down and restarting a jenkins process (effectively - killing the pod) helped, thanks a lot!

          Ivan Kurnosov added a comment - - edited

          Okay, it's back. So it looks like it's a race condition somewhere indeed.

          ```
          Caught unhandled exception with ID 8d917e05-24b4-42aa-97ee-78ead60cb474
          java.lang.LinkageError: loader (instance of hudson/ClassicPluginStrategy$AntClassLoader2): attempted duplicate class definition for name: "edu/hm/hafner/echarts/JacksonFacade"
          ```

          Nothing was upgraded, just the jenkins was restarted (the host machine needed to be shut down temporarily).

          PS: and in last comment I copied the wrong command line output, my hashes matched.

          Ivan Kurnosov added a comment - - edited Okay, it's back. So it looks like it's a race condition somewhere indeed. ``` Caught unhandled exception with ID 8d917e05-24b4-42aa-97ee-78ead60cb474 java.lang.LinkageError: loader (instance of hudson/ClassicPluginStrategy$AntClassLoader2): attempted duplicate class definition for name: "edu/hm/hafner/echarts/JacksonFacade" ``` Nothing was upgraded, just the jenkins was restarted (the host machine needed to be shut down temporarily). PS: and in last comment I copied the wrong command line output, my hashes matched.

          Ulli Hafner added a comment -

          Hmm, this class is just available once (since the release https://github.com/jenkinsci/echarts-api-plugin/releases/tag/v5.0.2-1).

          Ulli Hafner added a comment - Hmm, this class is just available once (since the release https://github.com/jenkinsci/echarts-api-plugin/releases/tag/v5.0.2-1 ).

          Might be a race condition in the Jenkins core instead, although then I'd expect the same error to occur with other classes as well.

          zerkms, which JVM are you using?

          Kalle Niemitalo added a comment - Might be a race condition in the Jenkins core instead, although then I'd expect the same error to occur with other classes as well. zerkms , which JVM are you using?

          Ivan Kurnosov added a comment -

          I'm using the official `jenkins/jenkins:2.277.3` docker image (lts), which is

          ```
          $ java -version
          openjdk version "1.8.0_282"
          OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
          OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode)
          ```

          Ivan Kurnosov added a comment - I'm using the official `jenkins/jenkins:2.277.3` docker image (lts), which is ``` $ java -version openjdk version "1.8.0_282" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode) ```

          Kalle Niemitalo added a comment - - edited

          I upgraded to Jenkins 2.277.4 and the latest plugins, and now I get the error again.

          toukokuuta 06, 2021 12:55:26 IP. WARNING hudson.init.impl.InstallUncaughtExceptionHandler handleException
          
          Caught unhandled exception with ID 5362ae1b-cdfb-4a4d-90be-1569d749adb1
          java.lang.LinkageError: loader (instance of  hudson/ClassicPluginStrategy$AntClassLoader2): attempted  duplicate class definition for name: "edu/hm/hafner/echarts/JacksonFacade"
          	at hudson.tasks.test.TestResultProjectAction.getBuildTrendModel(TestResultProjectAction.java:214)
          	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
          	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
          	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
          	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
          	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
          	at org.kohsuke.stapler.MetaClass$JavaScriptProxyMethodDispatcher.doDispatch(MetaClass.java:637)
          	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
          	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
          

          However, "grep -l -r JacksonFacade plugins" on the Jenkins controller finds only:

          • plugins/echarts-api/WEB-INF/lib/echarts-api.jar

          i.e. the class is not defined in more than one JAR file. I think I'll file a separate bug on Jenkins core, then.

          Kalle Niemitalo added a comment - - edited I upgraded to Jenkins 2.277.4 and the latest plugins, and now I get the error again. toukokuuta 06, 2021 12:55:26 IP. WARNING hudson.init.impl.InstallUncaughtExceptionHandler handleException Caught unhandled exception with ID 5362ae1b-cdfb-4a4d-90be-1569d749adb1 java.lang.LinkageError: loader (instance of hudson/ClassicPluginStrategy$AntClassLoader2): attempted duplicate class definition for name: "edu/hm/hafner/echarts/JacksonFacade" at hudson.tasks.test.TestResultProjectAction.getBuildTrendModel(TestResultProjectAction.java:214) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145) at org.kohsuke.stapler.MetaClass$JavaScriptProxyMethodDispatcher.doDispatch(MetaClass.java:637) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766) However, "grep -l -r JacksonFacade plugins" on the Jenkins controller finds only: plugins/echarts-api/WEB-INF/lib/echarts-api.jar i.e. the class is not defined in more than one JAR file. I think I'll file a separate bug on Jenkins core, then.

          Oh, there are already two open issues with "duplicate class definition":

          • JENKINS-64864 attempted duplicate class definition for name: "org/apache/commons/lang3/StringUtils"
          • JENKINS-65510 attempted duplicate class definition for name: "com/cloudbees/plugins/credentials/CredentialsMatcher$CQL"

          and three that I think are not related, because they involve CpsGroovyShell$CleanGroovyClassLoader rather than ClassicPluginStrategy$AntClassLoader2:

          • JENKINS-52907 attempted duplicate class definition for name: "lib/lib"
          • JENKINS-48628 attempted duplicate class definition for name: "com/example/jenkins/testcase/function"
          • JENKINS-49122 attempted duplicate class definition for name: "Github"

          Kalle Niemitalo added a comment - Oh, there are already two open issues with "duplicate class definition": JENKINS-64864 attempted duplicate class definition for name: "org/apache/commons/lang3/StringUtils" JENKINS-65510 attempted duplicate class definition for name: "com/cloudbees/plugins/credentials/CredentialsMatcher$CQL" and three that I think are not related, because they involve CpsGroovyShell$CleanGroovyClassLoader rather than ClassicPluginStrategy$AntClassLoader2: JENKINS-52907 attempted duplicate class definition for name: "lib/lib" JENKINS-48628 attempted duplicate class definition for name: "com/example/jenkins/testcase/function" JENKINS-49122 attempted duplicate class definition for name: "Github"

          I restarted Jenkins and first navigated to a project that collects warnings but does not run any tests, and thus has only one graph. That loaded OK. I then navigated to a project that has graphs for warnings and test results, and both graphs loaded OK. I think this sequence of requests avoided the race condition.

          Kalle Niemitalo added a comment - I restarted Jenkins and first navigated to a project that collects warnings but does not run any tests, and thus has only one graph. That loaded OK. I then navigated to a project that has graphs for warnings and test results, and both graphs loaded OK. I think this sequence of requests avoided the race condition.

          Ulli Hafner added a comment -

          I think it would make sense to report it in a way that the core team will see it. Otherwise plugin developers (like me) simply will do nothing because the error looks to be caused by something unrelated.

          Ulli Hafner added a comment - I think it would make sense to report it in a way that the core team will see it. Otherwise plugin developers (like me) simply will do nothing because the error looks to be caused by something unrelated.

          JENKINS-65766 was fixed in core. I hope "duplicate class definition" will no longer occur, then.

          Kalle Niemitalo added a comment - JENKINS-65766 was fixed in core. I hope "duplicate class definition" will no longer occur, then.

            drulli Ulli Hafner
            kon Kalle Niemitalo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: