jenkinsci / jenkinsci/workflow-aggregator-plugin
[JENKINS-56242] Jenkins pipeline lock mechanism is throwing null pointer exceptions
- Dominant language
- No language data
- Stars
- 225
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
I am getting this null pointer exception and the lock is not getting freed, it was working correctly for a long and suddenly started to throw this exceptions
// code placeholder
stage('Deploy to iDev') {
steps {
lock(resource: "$DEV_LOCK", inversePrecedence: true) {
script {
.
.
.
}
}
}
}
Below is the exception thrown:
{{}}
```
java.lang.NullPointerException at org.jenkins.plugins.lockableresources.LockableResourcesManager.freeResources(LockableResourcesManager.java:323) at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:367) at org.jenkins.plugins.lockableresources.LockStepExecution$Callback.finished(LockStepExecution.java:125) at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114) at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:368) at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73)
```
{{}}
---
Originally reported by rgowdatmx, imported from: Jenkins pipeline lock mechanism is throwing null pointer exceptions
Raw content of original issue
I am getting this null pointer exception and the lock is not getting freed, it was working correctly for a long and suddenly started to throw this exceptions
// code placeholder
stage('Deploy to iDev') {
steps {
lock(resource: "$DEV_LOCK", inversePrecedence: true) {
script {
.
.
.
}
}
}
}Below is the exception thrown:
{{}}
java.lang.NullPointerException at org.jenkins.plugins.lockableresources.LockableResourcesManager.freeResources(LockableResourcesManager.java:323) at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:367) at org.jenkins.plugins.lockableresources.LockStepExecution$Callback.finished(LockStepExecution.java:125) at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114) at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:368) at com.cloudbees.groovy.cps.Outcome.resumeFrom(Outcome.java:73){{}}
- environment:
Jenkins ver. 2.157
Contributor guide
Research direction
Start by inspecting LockableResourcesManager.java at lines 323 and 367, then follow the cleanup callback at LockStepExecution.java:125. Reproduce the supplied pipeline lock scenario and determine what causes the null pointer; done means the exception no longer occurs and the lock is freed correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100