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

NullPointerException in Github branch source plugin after upgrading

      I upgraded according to the guide, and suddenly all my multibranch jobs are gone from Jenkins. I look at the logs and see this for each of my job types:

      Failed Loading item <job name>
      java.lang.NullPointerException
      	at jenkins.branch.MultiBranchProject.onLoad(MultiBranchProject.java:171)
      	at hudson.model.Items.load(Items.java:372)
      	at jenkins.model.Jenkins$17.run(Jenkins.java:3061)
      	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:1066)
      	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 can recreate the jobs with the same names, upon which Jenkins reindexes from GitHub, "finds" the jobs for still-open branches and PRs, including their whole histories, and everything else works as it should. Old jobs still don't re-appear.

      But then when I restart Jenkins they're all gone again, and I have to do the whole dance again.

      As you can imagine, this is incredibly frustrating and a terrible time sink. What can I do to fix this, short of creating brand new jobs with lost history? I've tried to downgrade but the dependencies are too entangled. I have a backup of my plugin directory and plugin configs, but I'd really rather avoid regressive steps like that.

          [JENKINS-41207] NullPointerException in Github branch source plugin after upgrading

          John Zila added a comment -

          If you mean the "Manage Old Data" admin screen, then that one is empty.

          John Zila added a comment - If you mean the "Manage Old Data" admin screen, then that one is empty.

          John Zila added a comment -

          Thanks for all your help Stephen.

          My issue was partially because I was running beta versions of the plugins before so the upgrade path wasn't anticipated. I recovered my jobs from backup. After running the recommended master SNAPSHOT from the JENKINS-41209 fix, the jobs loaded correctly.

          John Zila added a comment - Thanks for all your help Stephen. My issue was partially because I was running beta versions of the plugins before so the upgrade path wasn't anticipated. I recovered my jobs from backup. After running the recommended master SNAPSHOT from the JENKINS-41209 fix, the jobs loaded correctly.

          Hi,
          I can see that this issue has been solved but i don't see any update available, even on experimental update center. Could you advise on what i should to fix the pb on my jenkins instance ?
          Thanks

          Alexandre Aubert added a comment - Hi, I can see that this issue has been solved but i don't see any update available, even on experimental update center. Could you advise on what i should to fix the pb on my jenkins instance ? Thanks

          aacebedo login to your Jenkins server. Go to the JENKINS_HOME/jobs directory and find the multi-branch project that is throwing this exception.

          Check the branches, if any of the branches have

          <?xml version='1.0' encoding='UTF-8'?>
          <flow-definition plugin="workflow-job@2.9">
            <actions/>
            <keepDependencies>false</keepDependencies>
            <properties>
              <org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty plugin="workflow-multibranch@2.10-beta-1"/>
              <jenkins.model.BuildDiscarderProperty>
                <strategy class="hudson.tasks.LogRotator">
                  <daysToKeep>10</daysToKeep>
                  <numToKeep>30</numToKeep>
                  <artifactDaysToKeep>-1</artifactDaysToKeep>
          ...
          

          The bit you are checking for is and empty org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty tag.

          If you have an empty org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty tag then you need to restore that from backup (if you don't have a backup you will need to do some other stuff - so email me (see earlier comments for address) )

          If you do not have an empty tag then check the plugin versions you are running. Most likely you have some beta versions of the SCM API related plugins.

          In all cases, you will need to manually download and update the plugins to the versions in https://www.dropbox.com/sh/ppjyc289rnnpfhx/AAA3msLPH2WhBGvL8990H4l5a?dl=0 and you will need to update branch-api to the current master branch -SNAPSHOT. But probably better if you can report the plugin versions you have on this ticket before upgrading anything and I will check back in 35min (school drop-off run)

          Stephen Connolly added a comment - aacebedo login to your Jenkins server. Go to the JENKINS_HOME/jobs directory and find the multi-branch project that is throwing this exception. Check the branches, if any of the branches have <?xml version= '1.0' encoding= 'UTF-8' ?> <flow-definition plugin= "workflow-job@2.9" > <actions/> <keepDependencies> false </keepDependencies> <properties> <org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty plugin= "workflow-multibranch@2.10-beta-1" /> <jenkins.model.BuildDiscarderProperty> <strategy class= "hudson.tasks.LogRotator" > <daysToKeep>10</daysToKeep> <numToKeep>30</numToKeep> <artifactDaysToKeep>-1</artifactDaysToKeep> ... The bit you are checking for is and empty org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty tag. If you have an empty org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty tag then you need to restore that from backup (if you don't have a backup you will need to do some other stuff - so email me (see earlier comments for address) ) If you do not have an empty tag then check the plugin versions you are running. Most likely you have some beta versions of the SCM API related plugins. In all cases, you will need to manually download and update the plugins to the versions in https://www.dropbox.com/sh/ppjyc289rnnpfhx/AAA3msLPH2WhBGvL8990H4l5a?dl=0 and you will need to update branch-api to the current master branch -SNAPSHOT. But probably better if you can report the plugin versions you have on this ticket before upgrading anything and I will check back in 35min (school drop-off run)

          Alexandre Aubert added a comment - - edited

          Thanks for this information. I checked all branches and "org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty" is well populated. Here is an example :

          <?xml version='1.0' encoding='UTF-8'?>
          <flow-definition plugin="workflow-job@2.9">
          <actions/>
          <keepDependencies>false</keepDependencies>
          <properties>
          <org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty plugin="workflow-multibranch@2.10">
          <branch plugin="branch-api@2.0.0">
          <sourceId>8a58dd48-3cfc-45af-b750-2d47224545cd</sourceId>
          <head plugin="scm-api@2.0.1">
          <name>dev</name>
          </head>
          <scm class="hudson.plugins.git.GitSCM" plugin="git@3.0.2">
          <configVersion>2</configVersion>
          <userRemoteConfigs>
          <hudson.plugins.git.UserRemoteConfig>
          <name>origin</name>
          <refspec>+refs/heads/:refs/remotes/origin/</refspec>
          <url>http://serverurl/DataViz/vega.git</url>
          <credentialsId>7bc32aa3-2c7d-44d1-8689-a1f2131e22ff</credentialsId>
          </hudson.plugins.git.UserRemoteConfig>
          </userRemoteConfigs>
          <branches class="singleton-list">
          <hudson.plugins.git.BranchSpec>
          <name>dev</name>
          </hudson.plugins.git.BranchSpec>
          </branches>
          <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
          <submoduleCfg class="empty-list"/>
          <extensions/>
          </scm>
          <properties/>
          <actions/>
          </branch>
          </org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty>
          </properties>
          <definition class="org.jenkinsci.plugins.workflow.multibranch.SCMBinder" plugin="workflow-multibranch@2.10"/>
          <triggers/>
          </flow-definition>

          Here are the versions of installed plugins, as displayed in update center :

          SCM API 2.0.1
          Github Branch Source 2.0.0
          GitHub Organization Folder Plugin 1.6
          Branch API 2.0.0
          GitHub API 1.84

          the only beta versions i have are related to BlueOcean, i don't think it could have an effect on that.

          Alexandre Aubert added a comment - - edited Thanks for this information. I checked all branches and "org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty" is well populated. Here is an example : <?xml version='1.0' encoding='UTF-8'?> <flow-definition plugin="workflow-job@2.9"> <actions/> <keepDependencies>false</keepDependencies> <properties> <org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty plugin="workflow-multibranch@2.10"> <branch plugin="branch-api@2.0.0"> <sourceId>8a58dd48-3cfc-45af-b750-2d47224545cd</sourceId> <head plugin="scm-api@2.0.1"> <name>dev</name> </head> <scm class="hudson.plugins.git.GitSCM" plugin="git@3.0.2"> <configVersion>2</configVersion> <userRemoteConfigs> <hudson.plugins.git.UserRemoteConfig> <name>origin</name> <refspec>+refs/heads/ :refs/remotes/origin/ </refspec> <url> http://serverurl/DataViz/vega.git </url> <credentialsId>7bc32aa3-2c7d-44d1-8689-a1f2131e22ff</credentialsId> </hudson.plugins.git.UserRemoteConfig> </userRemoteConfigs> <branches class="singleton-list"> <hudson.plugins.git.BranchSpec> <name>dev</name> </hudson.plugins.git.BranchSpec> </branches> <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations> <submoduleCfg class="empty-list"/> <extensions/> </scm> <properties/> <actions/> </branch> </org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty> </properties> <definition class="org.jenkinsci.plugins.workflow.multibranch.SCMBinder" plugin="workflow-multibranch@2.10"/> <triggers/> </flow-definition> Here are the versions of installed plugins, as displayed in update center : SCM API 2.0.1 Github Branch Source 2.0.0 GitHub Organization Folder Plugin 1.6 Branch API 2.0.0 GitHub API 1.84 the only beta versions i have are related to BlueOcean, i don't think it could have an effect on that.

          OK then in that case it is probably the JENKINS-41209 issue that is affecting you. I'll cut a beta release with that as it is at least merged to master

          Stephen Connolly added a comment - OK then in that case it is probably the JENKINS-41209 issue that is affecting you. I'll cut a beta release with that as it is at least merged to master

          Stephen Connolly added a comment - - edited

          aaubert https://www.dropbox.com/sh/ppjyc289rnnpfhx/AAA3msLPH2WhBGvL8990H4l5a?dl=0 has the 2.0.2-beta-1 release of branch-api now (with the fix for JENKINS-41209 which is what it looks like you have). Should be fine to upgrade and restart (you'll still have JENKINS-41121 though)

          Stephen Connolly added a comment - - edited aaubert https://www.dropbox.com/sh/ppjyc289rnnpfhx/AAA3msLPH2WhBGvL8990H4l5a?dl=0 has the 2.0.2-beta-1 release of branch-api now (with the fix for JENKINS-41209 which is what it looks like you have). Should be fine to upgrade and restart (you'll still have JENKINS-41121 though)

          after this install and restart of master, job is well back in display. There were some errors on trying to delete some items :

          WARNING: Failed to update org.jenkinsci.plugins.workflow.job.WorkflowJob@6ed3c55b[DataViz/VegaWebApp/Vega-Deploy/story-FH-88114-table-data.h05ibd] lastSuccessfulBuild permalink for DataViz/VegaWebApp/Vega-Deploy/story-FH-88114-table-data.h05ibd #10

          java.io.IOException: Unable to delete 'E:\Jenkins\jobs\DataViz\jobs\VegaWebApp\jobs\Vega-Deploy\branches\story-FH-88114-table-data.h05ibd\builds\lastSuccessfulBuild'. Tried 3 times (of a maximum of 3) waiting 0,1 s between attempts.

          I have a lot of those on different jobs, i don't if it's related to already identified issues.
          In any case, thanks for your help, we are now able to run our jobs.

          Regards,

          Alexandre Aubert added a comment - after this install and restart of master, job is well back in display. There were some errors on trying to delete some items : WARNING: Failed to update org.jenkinsci.plugins.workflow.job.WorkflowJob@6ed3c55b [DataViz/VegaWebApp/Vega-Deploy/story-FH-88114-table-data.h05ibd] lastSuccessfulBuild permalink for DataViz/VegaWebApp/Vega-Deploy/story-FH-88114-table-data.h05ibd #10 java.io.IOException: Unable to delete 'E:\Jenkins\jobs\DataViz\jobs\VegaWebApp\jobs\Vega-Deploy\branches\story-FH-88114-table-data.h05ibd\builds\lastSuccessfulBuild'. Tried 3 times (of a maximum of 3) waiting 0,1 s between attempts. I have a lot of those on different jobs, i don't if it's related to already identified issues. In any case, thanks for your help, we are now able to run our jobs. Regards,

          Stephen Connolly added a comment - - edited

          aaubert OK cool so your issue was JENKINS-41209 and not this issue.

          The permalink issue is probably just a windows file locking problem and "normal" (i.e. unrelated to SCM API changes)

          Stephen Connolly added a comment - - edited aaubert OK cool so your issue was JENKINS-41209 and not this issue. The permalink issue is probably just a windows file locking problem and "normal" (i.e. unrelated to SCM API changes)

          scm-api-2.0.2
          git-2.6.4 or git-3.0.4
          branch-api-2.0.2
          bitbucket-branch-source-2.0.2
          github-branch-source-2.0.1
          cloudbees-folder-5.17
          workflow-multibranch-2.11

          Stephen Connolly added a comment - scm-api-2.0.2 git-2.6.4 or git-3.0.4 branch-api-2.0.2 bitbucket-branch-source-2.0.2 github-branch-source-2.0.1 cloudbees-folder-5.17 workflow-multibranch-2.11

            stephenconnolly Stephen Connolly
            jzila John Zila
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: