[JIRA] (JENKINS-61005) Builds failing because Run defining the context within which to find P4 credential is null

32 views
Skip to first unread message

kqchen@uwaterloo.ca (JIRA)

unread,
Feb 6, 2020, 4:32:03 PM2/6/20
to jenkinsc...@googlegroups.com
Annie Chen created an issue
 
Jenkins / Bug JENKINS-61005
Builds failing because Run defining the context within which to find P4 credential is null
Issue Type: Bug Bug
Assignee: Unassigned
Components: core, p4-plugin
Created: 2020-02-06 21:31
Environment: Jenkins Server: Windows Server 2012 R2 (x86)
Slave Node: Linux CentOS 7 (amd64) (virtual machine)
Jenkins 2.219
P4 Plugin 1.10.9
Priority: Major Major
Reporter: Annie Chen

After an upgrade from Jenkins version 2.214 to 2.219, 2 of my Jenkins builds always fail within a few seconds and show the following stack trace:

FATAL: null
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Unknown Source)
at com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById(CredentialsProvider.java:873)
at org.jenkinsci.plugins.p4.client.ConnectionHelper.findCredential(ConnectionHelper.java:917)
at org.jenkinsci.plugins.p4.tagging.TagAction.getTicket(TagAction.java:218)
at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:89)
at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:32)
at org.jenkinsci.plugins.p4.PerforceScm.buildEnvironment(PerforceScm.java:727)
at hudson.scm.SCM.buildEnvVars(SCM.java:554)
at org.jenkinsci.plugins.p4.PerforceScm.buildEnvVars(PerforceScm.java:719)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:871)
at org.jenkinsci.plugins.p4.tasks.AbstractTask.setEnvironment(AbstractTask.java:92)
at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:514)
at hudson.scm.SCM.checkout(SCM.java:505)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1206)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1853)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Recording test results
ERROR: Build step failed with exception
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Unknown Source)
at com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById(CredentialsProvider.java:873)
at org.jenkinsci.plugins.p4.client.ConnectionHelper.findCredential(ConnectionHelper.java:917)
at org.jenkinsci.plugins.p4.tagging.TagAction.getTicket(TagAction.java:218)
at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:89)
at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:32)
at org.jenkinsci.plugins.p4.PerforceScm.buildEnvironment(PerforceScm.java:727)
at hudson.scm.SCM.buildEnvVars(SCM.java:554)
at org.jenkinsci.plugins.p4.PerforceScm.buildEnvVars(PerforceScm.java:719)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:871)
at hudson.tasks.junit.JUnitResultArchiver.parseAndAttach(JUnitResultArchiver.java:165)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:154)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
at hudson.model.Run.execute(Run.java:1878)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Build step 'Publish JUnit test result report' marked build as failure
ERROR: Build step failed with exception
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Unknown Source)
at com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById(CredentialsProvider.java:873)
at org.jenkinsci.plugins.p4.client.ConnectionHelper.findCredential(ConnectionHelper.java:917)
at org.jenkinsci.plugins.p4.tagging.TagAction.getTicket(TagAction.java:218)
at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.java:89)
at org.jenkinsci.plugins.p4.build.P4EnvironmentContributor.buildEnvironment(P4EnvironmentContributor.java:32)
at org.jenkinsci.plugins.p4.PerforceScm.buildEnvironment(PerforceScm.java:727)
at hudson.scm.SCM.buildEnvVars(SCM.java:554)
at org.jenkinsci.plugins.p4.PerforceScm.buildEnvVars(PerforceScm.java:719)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:871)
at hudson.tasks.Mailer.perform(Mailer.java:147)
at hudson.tasks.Mailer.perform(Mailer.java:138)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
at hudson.model.Run.execute(Run.java:1878)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Build step 'E-mail Notification' marked build as failure
Finished: FAILURE

I have never seen this failure before and nothing has been changed on the machine on which Jenkins runs these 2 builds, nor has anything been changed on Jenkins except for the version upgrade. Furthermore, the 2 other builds that run on that machine still work normally.

In GitHub, I had looked at the code the stack trace refers to. I looked at CredentialsProvider at https://github.com/jenkinsci/credentials-plugin/blob/master/src/main/java/com/cloudbees/plugins/credentials/CredentialsProvider.java , as this is what the 2nd line of the stack trace refers to. The problem is that the "Run defining the context within which to find the credential" is null. The 4th line of the stack trace is P4BaseCredentials auth = ConnectionHelper.findCredential(credential, getRun()); which can be found at https://github.com/jenkinsci/p4-plugin/blob/master/src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java . The getRun() method is that in the super class, https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/AbstractScmTagAction.java. However, the stack trace does not show me what code is setting this class's "run" variable.

The P4 Plugin version is 1.10.9; this had been upgraded from 1.10.6. However, I do not know when this upgrade was made.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

kwirth@perforce.com (JIRA)

unread,
Feb 7, 2020, 3:49:02 AM2/7/20
to jenkinsc...@googlegroups.com
Karl Wirth commented on Bug JENKINS-61005
 
Re: Builds failing because Run defining the context within which to find P4 credential is null

Hi Annie Chen - Thanks for letting us know.

Are you saying that you have 3 Perforce builds and only one is failing, or are you saying that all your Perforce builds are failing?

Please try the following tests:

  • Create a new Perforce job does that work?
  • Try creating a new credential that uses the same userid and password. Switch a failing job to using the new credential does that work?
  • Usually after an upgrade there is a cleanup old data option under Manage Jenkins. Did you run this already?

Please also give me additional information.

  • Is this a freestyle job?
  • Please send me screenshots showing how the job is defined and any Jenkinsfiles it may be using.

 

dbeck@cloudbees.com (JIRA)

unread,
Feb 7, 2020, 2:36:02 PM2/7/20
to jenkinsc...@googlegroups.com

nor has anything been changed on Jenkins except for the version upgrade

 

What other components besides Jenkins (core) and P4 plugin were updated?

kqchen@uwaterloo.ca (JIRA)

unread,
Feb 10, 2020, 3:13:03 PM2/10/20
to jenkinsc...@googlegroups.com

Hi Karl Wirth, Daniel Beck,

Thank you so much for your advice!

I have several different Perforce builds running on 3 different machines. 2 of the machines are Windows; the other is Linux. The Windows builds still run normally, as do 2 of the 4 Linux builds. It is the other 2 Linux builds that are failing.

Last Friday, I tried creating a new Perforce job and also creating a new credential with the same userid and password and having the 2 failing jobs use the new credential instead. I did not encounter this NullPointerException again. The new Perforce job works normally. The 2 failing jobs hung, but this seems to be because I ran them at the same time. I stopped those 2 jobs this morning and restarted just 1 of them. It ran normally. I have not tried running the other 1 yet, though it is scheduled to run tonight. In summary, creating a new credential seems to have fixed the problem. Therefore, I think this Bug can be closed. (I can close it if you prefer, but I just wanted to check whether you would like to close it so it shows you handled it.)

Thank you so much for your help! I really appreciate it!

kwirth@perforce.com (JIRA)

unread,
Feb 11, 2020, 7:20:02 AM2/11/20
to jenkinsc...@googlegroups.com

Hi Annie Chen - Thanks and I'm happy I could help. If the problem comes back or if there is anything else we can do to help, please let us know.

kwirth@perforce.com (JIRA)

unread,
Feb 11, 2020, 7:21:03 AM2/11/20
to jenkinsc...@googlegroups.com
Karl Wirth closed an issue as Fixed
 

Credential corruption possibly due to another plugin being upgraded. In the past I have seen that saving the credential and then saving the job can solve the problem. In this case recreating the credential seems to have solved the problem.

Change By: Karl Wirth
Status: Open Closed
Resolution: Fixed
Reply all
Reply to author
Forward
0 new messages