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

NullPointerException in Plot plugin (pipeline)

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • plot-plugin
    • Jenkins 2.121.1, plot-plugin 2.1.0

      After the update to 2.1.0 (don't remember which version we had before, but probably < 2.0) we get consistently an "Oops" page from Jenkins when accessing the "Plots" page of a specific job.

      The stack trace looks like this:

       

      java.lang.NullPointerException
      	at hudson.plugins.plot.Plot.compareTo(Plot.java:403)
      	at hudson.plugins.plot.Plot.compareTo(Plot.java:78)
      	at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:320)
      	at java.util.ComparableTimSort.sort(ComparableTimSort.java:188)
      	at java.util.Arrays.sort(Arrays.java:1312)
      	at java.util.Arrays.sort(Arrays.java:1506)
      	at java.util.ArrayList.sort(ArrayList.java:1462)
      	at java.util.Collections.sort(Collections.java:141)
      	at hudson.plugins.plot.PlotReport.<init>(PlotReport.java:52)
      	at hudson.plugins.plot.PlotAction.getTarget(PlotAction.java:96)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:674)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:105)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:530)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
      	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)

      After experimenting with a couple of test jobs I have come to this conclusion:

      • The crash only happens in a pipeline job, not freestyle
      • The crash only happens when there are multiple plots in the same group (have only tried a single group with 2 plots, though)
        • If the plots are in separate groups, everything is OK
      • The crash only happens if the plots have no title (whether set to '' or just left out)
        • It doesn't matter whether the titles are identical or not

      This small pipeline snippet will demonstrate the problem. Build it, then access "Plots", and you should get the crash:

      pipeline {
          agent any
          stages {
              stage('test') {
                  steps {
                      sh 'echo "S\n$(date +%S)" > values-1.csv'
                      sh 'echo "N\n$(date +%N)" > values-1.csv'
                      plot csvFileName: 'plot-1.csv', csvSeries: [[file: 'values-1.csv']], group: 'test', style: 'line', title: ''
                      plot csvFileName: 'plot-2.csv', csvSeries: [[file: 'values-2.csv']], group: 'test', style: 'line', title: ''
                  }
              }
          }
      }

      Maybe a clue: The resulting files (e.g plot-1.csv) begin with these two lines:

      "Title",
      "Value","Series Label","Build Number","Build Date","URL"
      

      Note the absence of value in line 1. For freestyle jobs, the first line has a "" after the comma.

       

          [JENKINS-52128] NullPointerException in Plot plugin (pipeline)

          pharman Thanks for reporting. I played with a pipeline sample you provided.  

          The crash only happens if the plots have no title (whether set to '' or just left out). 

          It doesn't matter whether the titles are identical or not

          You're right, the bug is reproducible if the title is empty. 

          The title field is marked as optional - "Optional. Specifies the plot title. Plots will be displayed alphabetically by group and then by title."
          l think "Plot Title" shouldn't be optional anymore, but rather mandatory with "Group Title".

          Veaceslav Gaidarji added a comment - pharman Thanks for reporting. I played with a pipeline sample you provided.   The crash only happens if the plots have no title (whether set to '' or just left out).  It doesn't matter whether the titles are identical or not You're right, the bug is reproducible if the title is empty.  The title field is marked as optional - "Optional. Specifies the plot title. Plots will be displayed alphabetically by group and then by title." l think "Plot Title" shouldn't be optional anymore, but rather mandatory with "Group Title".

            vgaidarji Veaceslav Gaidarji
            pharman Torben Thellefsen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: