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

Copy Artifact sometimes crashes on startup (Jenkins#getDescriptorByType looks sometimes return null)

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: copyartifact-plugin, core
    • Labels:
      None
    • Environment:
      openjdk 1.8.0_121
      Jenkins 2.51
      Copy Artifact 1.38.1
    • Similar Issues:

      Description

      Until very recently, I never had Run Selector installed, and Copy Artifact worked just fine. Today, I updated a bunch of plugins (especially the SCM API 2 stuff) and Jenkins core, and suddenly Copy Artifact failed to initalize with an NPE:

      java.lang.NullPointerException
      at hudson.plugins.copyartifact.BuildSelectorParameter.initAliases(BuildSelectorParameter.java:156)
      at hudson.plugins.copyartifact.CopyArtifactPlugin.postInitialize(CopyArtifactPlugin.java:35)
      at hudson.PluginManager$2$1$2.run(PluginManager.java:543)
      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:1064)
      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)

      I initially thought that installing the Run Selector plugin fixed this problem, despite never needing it before and there not being a dependency. However, I have now seen the crash return one time on startup, even with Run Selector installed, and then go away after another restart of Jenkins. So it seems to be nondeterministic and happen during some boots but not others.

        Attachments

        1. fail.log
          16 kB
        2. pass.log
          5 kB

          Activity

          Hide
          ikedam ikedam added a comment -

          > due to getBuildSelectors returning null

          Maybe.
          It means Jenkins#getDescriptorList returns null.
          It's really strange and I have no idea why it happens, anyway...

          Show
          ikedam ikedam added a comment - > due to getBuildSelectors returning null Maybe. It means Jenkins#getDescriptorList returns null. It's really strange and I have no idea why it happens, anyway...
          Hide
          ikedam ikedam added a comment -

          Christopher Head

          Would you see what is output when you run the following code in Manage Jenkins > Script Console ?
          (when the copyartifact crashed in startup):

          import hudson.plugins.copyartifact.BuildSelector;
          import hudson.plugins.copyartifact.BuildSelectorParameter;
          
          println('-----')
          println(Jenkins.instance.getDescriptorByType(BuildSelectorParameter.DescriptorImpl.class));
          println('-----')
          println(Jenkins.instance.getDescriptorByType(BuildSelectorParameter.DescriptorImpl.class).getBuildSelectors());
          println('-----')
          println(Jenkins.instance.<BuildSelector,Descriptor<BuildSelector>>getDescriptorList(BuildSelector.class));
          println('-----')

          An example output in my environment:

          -----
          hudson.plugins.copyartifact.BuildSelectorParameter$DescriptorImpl@433514fe
          -----
          [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@6e3bcc25, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@39642e00, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@1f631eff, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@1263654f, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@2289c9c2, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@3a85f7bd, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3d1682f4, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@34d6d104, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@587dd985]
          -----
          [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@6e3bcc25, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@39642e00, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@1f631eff, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@1263654f, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@2289c9c2, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@3a85f7bd, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3d1682f4, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@34d6d104, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@587dd985]
          -----
          Show
          ikedam ikedam added a comment - Christopher Head Would you see what is output when you run the following code in Manage Jenkins > Script Console ? (when the copyartifact crashed in startup): import hudson.plugins.copyartifact.BuildSelector; import hudson.plugins.copyartifact.BuildSelectorParameter; println( '-----' ) println(Jenkins.instance.getDescriptorByType(BuildSelectorParameter.DescriptorImpl.class)); println( '-----' ) println(Jenkins.instance.getDescriptorByType(BuildSelectorParameter.DescriptorImpl.class).getBuildSelectors()); println( '-----' ) println(Jenkins.instance.<BuildSelector,Descriptor<BuildSelector>>getDescriptorList(BuildSelector.class)); println( '-----' ) An example output in my environment: ----- hudson.plugins.copyartifact.BuildSelectorParameter$DescriptorImpl@433514fe ----- [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@6e3bcc25, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@39642e00, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@1f631eff, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@1263654f, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@2289c9c2, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@3a85f7bd, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3d1682f4, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@34d6d104, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@587dd985] ----- [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@6e3bcc25, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@39642e00, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@1f631eff, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@1263654f, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@2289c9c2, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@3a85f7bd, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3d1682f4, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@34d6d104, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@587dd985] -----
          Hide
          haw777 Christopher Head added a comment -
          org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
          Script1.groovy: 1: unable to resolve class hudson.plugins.copyartifact.BuildSelector
           @ line 1, column 1.
             import hudson.plugins.copyartifact.BuildSelector;
             ^
          
          Script1.groovy: 2: unable to resolve class hudson.plugins.copyartifact.BuildSelectorParameter
           @ line 2, column 1.
             import hudson.plugins.copyartifact.BuildSelectorParameter;
             ^
          
          Script1.groovy: 9: unable to resolve class hudson.plugins.copyartifact.BuildSelector 
           @ line 9, column 52.
             nce.<BuildSelector,Descriptor<BuildSelec
          
          Show
          haw777 Christopher Head added a comment - org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 1: unable to resolve class hudson.plugins.copyartifact.BuildSelector @ line 1, column 1. import hudson.plugins.copyartifact.BuildSelector; ^ Script1.groovy: 2: unable to resolve class hudson.plugins.copyartifact.BuildSelectorParameter @ line 2, column 1. import hudson.plugins.copyartifact.BuildSelectorParameter; ^ Script1.groovy: 9: unable to resolve class hudson.plugins.copyartifact.BuildSelector @ line 9, column 52. nce.<BuildSelector,Descriptor<BuildSelec
          Hide
          haw777 Christopher Head added a comment -

          By the way, when it doesn’t crash, this is what I see:

          -----
          hudson.plugins.copyartifact.BuildSelectorParameter$DescriptorImpl@52bd274a
          -----
          [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@23b7cdab, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@4471979e, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@6290d06b, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@23ae25a8, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3ee96ee3, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@766cd3c7, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@121b56e9, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@40caa267, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@35a152eb]
          -----
          [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@23b7cdab, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@4471979e, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@6290d06b, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@23ae25a8, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3ee96ee3, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@766cd3c7, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@121b56e9, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@40caa267, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@35a152eb]
          -----
          
          Show
          haw777 Christopher Head added a comment - By the way, when it doesn’t crash, this is what I see: ----- hudson.plugins.copyartifact.BuildSelectorParameter$DescriptorImpl@52bd274a ----- [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@23b7cdab, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@4471979e, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@6290d06b, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@23ae25a8, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3ee96ee3, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@766cd3c7, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@121b56e9, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@40caa267, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@35a152eb] ----- [hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@23b7cdab, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@4471979e, hudson.plugins.copyartifact.TriggeredBuildSelector$DescriptorImpl@6290d06b, hudson.plugins.copyartifact.DownstreamBuildSelector$DescriptorImpl@23ae25a8, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@3ee96ee3, hudson.plugins.copyartifact.PermalinkBuildSelector$DescriptorImpl@766cd3c7, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@121b56e9, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@40caa267, hudson.plugins.copyartifact.SimpleBuildSelectorDescriptor@35a152eb] -----
          Hide
          ikedam ikedam added a comment -

          Should be fixed in copyartifact-1.39.
          It will be available in the update center in a day.

          I'm yet not sure what's the root cause, but this happened on ci.jenkins.io, and I did some fixes and looks work correct.
          Please try that.

          Show
          ikedam ikedam added a comment - Should be fixed in copyartifact-1.39. It will be available in the update center in a day. I'm yet not sure what's the root cause, but this happened on ci.jenkins.io, and I did some fixes and looks work correct. Please try that.

            People

            • Assignee:
              haw777 Christopher Head
              Reporter:
              haw777 Christopher Head
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: