[JIRA] (JENKINS-52638) Lockable Resource Plugin returns null resource after saving system configuration

4 views
Skip to first unread message

scott.zhong@roguewave.com (JIRA)

unread,
Jul 18, 2018, 3:17:02 PM7/18/18
to jenkinsc...@googlegroups.com
Scott Zhong created an issue
 
Jenkins / Bug JENKINS-52638
Lockable Resource Plugin returns null resource after saving system configuration
Issue Type: Bug Bug
Assignee: Unassigned
Components: lockable-resources-plugin
Created: 2018-07-18 19:16
Environment: CentOS 7.4 host
java-8-openjdk-amd64
jenkins/jenkins:lts docker image
JENKINS_VERSION 2.121.2
lockable-resources 2.3

full plugin list:
ace-editor 1.1 true
ant 1.8 true
antisamy-markup-formatter 1.5 true
apache-httpcomponents-client-4-api 4.5.5-3.0 true
authentication-tokens 1.3 true
bouncycastle-api 2.16.3 true
branch-api 2.0.20 true
build-timeout 1.19 true
cloudbees-folder 6.5.1 true
command-launcher 1.2 true
credentials 2.1.17 true
credentials-binding 1.16 true
display-url-api 2.2.0 true
docker-commons 1.13 true
docker-workflow 1.17 true
durable-task 1.22 true
email-ext 2.62 true
git 3.9.1 true
git-client 2.7.2 true
git-server 1.7 true
github 1.29.2 true
github-api 1.92 true
github-branch-source 2.3.6 true
gradle 1.29 true
handlebars 1.1.1 true
jackson2-api 2.8.11.3 true
jdk-tool 1.1 true
jquery-detached 1.2.1 true
jsch 0.1.54.2 true
junit 1.24 true
ldap 1.20 true
lockable-resources 2.3 true
mailer 1.21 true
mapdb-api 1.0.9.0 true
matrix-auth 2.3 true
matrix-project 1.13 true
momentjs 1.1.1 true
pam-auth 1.3 true
pipeline-build-step 2.7 true
pipeline-github-lib 1.0 true
pipeline-graph-analysis 1.7 true
pipeline-input-step 2.8 true
pipeline-milestone-step 1.3.1 true
pipeline-model-api 1.3.1 true
pipeline-model-declarative-agent 1.1.1 true
pipeline-model-definition 1.3.1 true
pipeline-model-extensions 1.3.1 true
pipeline-rest-api 2.10 true
pipeline-stage-step 2.3 true
pipeline-stage-tags-metadata 1.3.1 true
pipeline-stage-view 2.10 true
plain-credentials 1.4 true
resource-disposer 0.11 true
scm-api 2.2.7 true
script-security 1.44 true
ssh-credentials 1.14 true
ssh-slaves 1.26 true
structs 1.14 true
subversion 2.11.1 true
throttle-concurrents 2.0.1 true
timestamper 1.8.10 true
token-macro 2.5 true
workflow-aggregator 2.5 true
workflow-api 2.28 true
workflow-basic-steps 2.9 true
workflow-cps 2.54 true
workflow-cps-global-lib 2.9 true
workflow-durable-task-step 2.19 true
workflow-job 2.23 true
workflow-multibranch 2.20 true
workflow-scm-step 2.6 true
workflow-step-api 2.16 true
workflow-support 2.19 true
ws-cleanup 0.34 true
Priority: Minor Minor
Reporter: Scott Zhong

The lock step can obtain a null resource after saving a global system configuration by clicking on "Manage Jenkins" -> "Configure System" -> "Save".  The bug occurs irregardless of any actual changes has been made.

steps to reproduce

setup

  • 4 jobs with the following configuration:
    node {
        boolean retry = true;
        while (retry) {
            lock(label: 'res1', quantity: 1, variable: 'RES_NAME') {
                println env.RES_NAME
                if ("${env.RES_NAME}" != "null") {
                    retry = false;
                    sleep(100)
                }
            }
        }
    }
  • 2 resources configured "r1" and "r2", both with label "res1"
  • 4 executors.

Steps

  1. Activate a build for each of the jobs simultaneously. 2 of the builds will obtain a lock and then proceed to sleep.  2 of the builds will be blocked waiting for a resource.
  2. Update the system configuration by clicking on "Manage Jenkins" -> "Configure System" -> "Save"
  3. One of the blocked build will obtain a "null" resource and re-trying a lock will obtain a resource that is already being used by one of the sleeping build. Demonstrated by the following snippet of the console output:
 Running on Jenkins in /var/jenkins_home/workspace/test4@2
[Pipeline] {
[Pipeline] lock
Trying to acquire lock on [Label: res1, Quantity: 1]
Found 0 available resource(s). Waiting for correct amount: 1.
[Label: res1, Quantity: 1] is locked, waiting...
Lock acquired on [Label: res1, Quantity: 1]
[Pipeline] {
[Pipeline] echo
null
[Pipeline] }
Lock released on resource [Label: res1, Quantity: 1]
[Pipeline] // lock
[Pipeline] lock
Trying to acquire lock on [Label: res1, Quantity: 1]
Lock acquired on [Label: res1, Quantity: 1]
[Pipeline] {
[Pipeline] echo
r1
[Pipeline] sleep
Sleeping for 1 min 40 sec[Pipeline] }
Lock released on resource [Label: res1, Quantity: 1]
[Pipeline] // lock
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

stalle+jenkins-ci@gmail.com (JIRA)

unread,
Nov 5, 2018, 10:02:02 AM11/5/18
to jenkinsc...@googlegroups.com
Staffan Forsell updated an issue
Change By: Staffan Forsell
Priority: Minor Major
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

stalle+jenkins-ci@gmail.com (JIRA)

unread,
Nov 5, 2018, 10:06:02 AM11/5/18
to jenkinsc...@googlegroups.com
Staffan Forsell commented on Bug JENKINS-52638
 
Re: Lockable Resource Plugin returns null resource after saving system configuration

Just hit this issue and I raised the priority.

This is a bug that wastes a lot of time for someone trying to debug broken build scripts, when it's actually not a broken at all.

DuAell@gmail.com (JIRA)

unread,
Feb 28, 2019, 9:15:03 AM2/28/19
to jenkinsc...@googlegroups.com

Seems to happens also when a job is waiting in queue and someone goes to the lockable resource page to reserve or unreserve a station. The queued job will then get a "null" resource when it will run.

vikashlegend@gmail.com (JIRA)

unread,
May 30, 2019, 6:31:02 AM5/30/19
to jenkinsc...@googlegroups.com

tobias-jenkins@23.gs (JIRA)

unread,
Feb 26, 2020, 4:12:04 PM2/26/20
to jenkinsc...@googlegroups.com

This is a problem with how the plugin is designed, since the plugin uses the same classes to manage configured and locked resources. The "easiest" solution would be to implement a custom save function which carefully merges "new" and "old" resources...

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages