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

New PluginWrapper#getDeprecations triggers NPE under certain conditions

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Support-core test SupportActionTest#takeSnapshotAndMakeSureSomethingHappens fails with:

       14.956 [id=20]        WARNING c.c.j.support.SupportPlugin#appendManifestContents: Could not get content from Administrative monitors for support bundle
      java.lang.NullPointerException
              at hudson.PluginWrapper.getDeprecations(PluginWrapper.java:1310)
              at hudson.PluginWrapper.isDeprecated(PluginWrapper.java:379)
              at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
              at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
              at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
              at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
              at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
              at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
              at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
              at hudson.PluginManager$PluginDeprecationMonitor.getDeprecatedPlugins(PluginManager.java:2264)
              at hudson.PluginManager$PluginDeprecationMonitor.isActivated(PluginManager.java:2258)
              at com.cloudbees.jenkins.support.impl.AdministrativeMonitors.addContents(AdministrativeMonitors.java:67)
      
      

      It's because this commit https://github.com/jenkinsci/jenkins/commit/d213ef962cb818a2b244b374cdc518133bbe6d32#diff-dd00e0527600a2b32c10fe2d5af188adR1310 added to 2.246 onwards.

      The root cause is site.getData() is null. Only a null check is needed.

      Does it deserve be included in 2.249.1 backport?

        Attachments

          Activity

          Show
          mramonleon Ramon Leon added a comment - Fixed on  https://github.com/jenkinsci/jenkins/commit/3ea9dc6b3ad4e158b19060f7f0f969577b5a22cf
          Hide
          mramonleon Ramon Leon added a comment - - edited

          I propose this fix (https://github.com/jenkinsci/jenkins/pull/4881) to be included in 2.249.1 because it may trigger a NPE if the PluginDeprecationMonitor is enabled.

          Show
          mramonleon Ramon Leon added a comment - - edited I propose this fix ( https://github.com/jenkinsci/jenkins/pull/4881 ) to be included in 2.249.1 because it may trigger a NPE if the  PluginDeprecationMonitor is enabled.
          Hide
          mramonleon Ramon Leon added a comment - - edited

          Risks assessment:
           
          There is an uncaught NPE in PluginWrapper#getDeprecations. It's triggered whenever the UpdateSite latest data information is null. Initially I thought it's only possible in Test environment, but maybe it's possible to be null on production as well; for example, after a call to UpdateSite#doInvalidateData or if the updates/xxx.json file is not found.
           
          When is this called? It's called on every page load because an AdministrativeMonitor calls this method. So the logs will fill up with

          2020-08-31 14:20:16.841+0000 [id=89] WARNING jenkins.model.Jenkins#lambda$getActiveAdministrativeMonitors$1
           java.lang.NullPointerException
           at hudson.PluginWrapper.getDeprecations(PluginWrapper.java:1310)
           at hudson.PluginWrapper.isDeprecated(PluginWrapper.java:379)
           at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
           at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
           at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
           at hudson.PluginManager$PluginDeprecationMonitor.getDeprecatedPlugins(PluginManager.java:2264)
           at hudson.PluginManager$PluginDeprecationMonitor.isActivated(PluginManager.java:2258)
          ...
          ...

          Although Jenkins will remain responsive. (edited) 
           
          Besides the monitor, any other code calling PluginWrapper#isDeprecated may trigger the same exception.

          Show
          mramonleon Ramon Leon added a comment - - edited Risks assessment:   There is an uncaught NPE in  PluginWrapper#getDeprecations . It's triggered whenever the  UpdateSite latest data information is   null . Initially I thought it's only possible in Test environment, but maybe it's possible to be null on production as well; for example, after a call to UpdateSite#doInvalidateData or if the updates/xxx.json file is not found.   When is this called? It's called on  every page load  because an AdministrativeMonitor calls this method. So the logs will fill up with 2020-08-31 14:20:16.841+0000 [id=89] WARNING jenkins.model.Jenkins#lambda$getActiveAdministrativeMonitors$1 java.lang.NullPointerException at hudson.PluginWrapper.getDeprecations(PluginWrapper.java:1310) at hudson.PluginWrapper.isDeprecated(PluginWrapper.java:379) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) at hudson.PluginManager$PluginDeprecationMonitor.getDeprecatedPlugins(PluginManager.java:2264) at hudson.PluginManager$PluginDeprecationMonitor.isActivated(PluginManager.java:2258) ... ... Although Jenkins will remain  responsive . (edited)    Besides the monitor, any other code calling PluginWrapper#isDeprecated may trigger the same exception.
          Hide
          markewaite Mark Waite added a comment - - edited

          I'm seeing the null pointer exception in my Jenkins installation of Jenkins 2.249.1. The stack trace looks like this:

          2020-09-16 17:48:45.404+0000 [id=18]    WARNING jenkins.model.Jenkins#lambda$getActiveAdministrativeMonitors$1
          java.lang.NullPointerException
                  at hudson.PluginWrapper.getDeprecations(PluginWrapper.java:1310)
                  at hudson.PluginWrapper.isDeprecated(PluginWrapper.java:379)
                  at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
                  at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
                  at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
                  at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
                  at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
                  at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
                  at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
                  at hudson.PluginManager$PluginDeprecationMonitor.getDeprecatedPlugins(PluginManager.java:2264)
                  at hudson.PluginManager$PluginDeprecationMonitor.isActivated(PluginManager.java:2258)
          

          Fix appears to have first been included in Jenkins 2.251 and appears that it was not backported to 2.249.1.

          Show
          markewaite Mark Waite added a comment - - edited I'm seeing the null pointer exception in my Jenkins installation of Jenkins 2.249.1. The stack trace looks like this: 2020-09-16 17:48:45.404+0000 [id=18] WARNING jenkins.model.Jenkins#lambda$getActiveAdministrativeMonitors$1 java.lang.NullPointerException at hudson.PluginWrapper.getDeprecations(PluginWrapper.java:1310) at hudson.PluginWrapper.isDeprecated(PluginWrapper.java:379) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at hudson.PluginManager$PluginDeprecationMonitor.getDeprecatedPlugins(PluginManager.java:2264) at hudson.PluginManager$PluginDeprecationMonitor.isActivated(PluginManager.java:2258) Fix appears to have first been included in Jenkins 2.251 and appears that it was not backported to 2.249.1.

            People

            Assignee:
            mramonleon Ramon Leon
            Reporter:
            mramonleon Ramon Leon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: