Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it.getQueue() in /lockable-resources/. Reason: java.lang.NullPointerException #608

Closed
kaniapm opened this issue Jan 10, 2024 · 7 comments · Fixed by #609
Closed

it.getQueue() in /lockable-resources/. Reason: java.lang.NullPointerException #608

kaniapm opened this issue Jan 10, 2024 · 7 comments · Fixed by #609
Labels

Comments

@kaniapm
Copy link

kaniapm commented Jan 10, 2024

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Jenkins: 2.440
OS: Linux - 4.18.0-527.el8.x86_64
Java: 17.0.6-ea - Red Hat, Inc. (OpenJDK 64-Bit Server VM)

Parameterized-Remote-Trigger:3.2.0
adoptopenjdk:1.5
analysis-model-api:11.14.0
ansible:307.va_1f3ef06575a_
ansicolor:1.0.4
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
apache-httpcomponents-client-5-api:5.3-1.0
artifactdeployer:1.3
audit-trail:361.v82cde86c784e
authentication-tokens:1.53.v1c90fd9191a_b_
authorize-project:1.7.1
badge:1.9.1
basic-branch-build-strategies:81.v05e333931c7d
block-queued-job:0.2.0
blueocean:1.27.9
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.9
blueocean-commons:1.27.9
blueocean-config:1.27.9
blueocean-core-js:1.27.9
blueocean-dashboard:1.27.9
blueocean-display-url:2.4.2
blueocean-events:1.27.9
blueocean-git-pipeline:1.27.9
blueocean-github-pipeline:1.27.9
blueocean-i18n:1.27.9
blueocean-jira:1.27.9
blueocean-jwt:1.27.9
blueocean-personalization:1.27.9
blueocean-pipeline-api-impl:1.27.9
blueocean-pipeline-editor:1.27.9
blueocean-pipeline-scm-api:1.27.9
blueocean-rest:1.27.9
blueocean-rest-impl:1.27.9
blueocean-web:1.27.9
bootstrap5-api:5.3.2-3
bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9
branch-api:2.1144.v1425d1c3d5a_7
build-blocker-plugin:1.7.9
build-monitor-plugin:1.14-826.vb_a_c11536174d
build-name-setter:2.4.0
build-timeout:1.32
build-timestamp:1.0.3
build-token-root:151.va_e52fe3215fc
build-user-vars-plugin:1.9
build-with-parameters:76.v9382db_f78962
built-on-column:1.4
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.0.2
cloud-stats:336.v788e4055508b_
cloudbees-bitbucket-branch-source:856.v04c46c86f911
cloudbees-disk-usage-simple:203.v3f46a_7462b_1a_
cloudbees-folder:6.858.v898218f3609d
cobertura:1.17
code-coverage-api:4.99.0
command-launcher:107.v773860566e2e
commons-httpclient3-api:3.1-3
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.11.0-95.v22a_d30ee5d36
config-file-provider:959.vcff671a_4518b_
configuration-as-code:1763.vb_fe9c1b_83f7b
configurationslicing:548.ve92d48e66b_f8
copyartifact:722.v0662a_9b_e22a_c
coverage:1.7.0
credentials:1311.vcf0a_900b_37c2
credentials-binding:642.v737c34dea_6c2
cucumber-perf:2.0.9
cucumber-reports:5.8.1
cucumber-testresult-plugin:0.10.1
cucumber-trends-report:1.3
dashboard-view:2.495.v07e81500c3f2
data-tables-api:1.13.8-2
database:191.vd5981b_97a_5fa_
database-mysql:34.va_cfc7a_5a_ef30
delivery-pipeline-plugin:1.4.2
description-setter:1.10
discard-old-build:1.07
disk-usage:1.2
display-url-api:2.200.vb_9327d658781
docker-build-publish:1.4.0
docker-build-step:2.11
docker-commons:439.va_3cb_0a_6a_fb_29
docker-compose-build-step:1.0
docker-java-api:3.3.4-86.v39b_a_5ede342c
docker-plugin:1.5
docker-workflow:572.v950f58993843
dtkit-api:3.0.2
durable-task:543.v262f6a_803410
echarts-api:5.4.3-2
email-ext:2.103
emailext-template:1.5
embeddable-build-status:467.v4a_954796e45d
envinject:2.908.v66a_774b_31d93
envinject-api:1.199.v3ce31253ed13
exclusive-execution:0.8
extended-read-permission:53.v6499940139e5
extensible-choice-parameter:1.8.1
external-monitor-job:215.v2e88e894db_f8
extra-columns:1.26
favorite:2.208.v91d65b_7792a_c
file-operations:177.vd1773063d935
font-awesome-api:6.5.1-1
forensics-api:2.3.0
generic-webhook-trigger:1.88.2
git:5.2.1
git-changelog:3.36
git-client:4.6.0
git-parameter:0.9.19
git-server:99.va_0826a_b_cdfa_d
github:1.37.3.1
github-api:1.318-461.v7a_c09c9fa_d63
github-branch-source:1767.va_7d01ea_c7256
groovy:457.v99900cb_85593
groovy-postbuild:228.vcdb_cf7265066
gson-api:2.10.1-15.v0d99f670e0a_7
h2-api:11.1.4.199-12.v9f4244395f7a_
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
htmlpublisher:1.32
http_request:1.18
inline-pipeline:1.0.3
instance-identity:185.v303dc7c645f9
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.16.1-373.ve709c6871598
jacoco:3.3.5
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:243.vb_b_503b_b_45537
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.9-1
jdk-tool:73.vddf737284550
jenkins-design-language:1.27.9
jersey2-api:2.41-133.va_03323b_a_1396
jira:3.12
jjwt-api:0.11.5-77.v646c772fddb_0
jnr-posix-api:3.1.18-1
job-dsl:1.87
job-import-plugin:3.6
jobConfigHistory:1229.v3039470161a_d
joda-time-api:2.12.5-5.v5495a_235fedf
join:1.21
jquery:1.12.4-1
jquery3-api:3.7.1-1
jsch:0.2.16-86.v42e010d9484b_
json-api:20231013-17.v1c97069404b_e
json-path-api:2.8.0-21.v8b_7dc8b_1037b_
junit:1252.vfc2e5efa_294f
kubernetes:4174.v4230d0ccd951
kubernetes-cli:1.12.1
kubernetes-client-api:6.9.2-239.ve49a_3f285167
kubernetes-credentials:0.11
ldap:711.vb_d1a_491714dc
locale:431.v3435fa_8f8445
localization-support:1.2
lockable-resources:1224.v5e9500f98269
log-parser:2.3.3
m2release:0.16.4
mailer:463.vedf8358e006b_
mapdb-api:1.0.9-28.vf251ce40855d
mask-passwords:173.v6a_077a_291eb_5
matrix-auth:3.2.1
matrix-project:822.v01b_8c85d16d2
maven-plugin:3.23
metrics:4.2.18-442.v02e107157925
metrics-diskusage:3.0.0
mina-sshd-api-common:2.11.0-86.v836f585d47fa_
mina-sshd-api-core:2.11.0-86.v836f585d47fa_
monitor-pro:1.0.9
monitoring:1.95.0
multibranch-scan-webhook-trigger:1.0.11
mysql-api:8.2.0-17.v16b_770955e53
naginator:1.436.vb_e769dcb_cdf6
nested-view:1.33
next-build-number:1.8
node-iterator-api:55.v3b_77d4032326
nodejs:1.6.1
nodelabelparameter:1.12.0
oauth-credentials:0.646.v02b_66dc03d2e
okhttp-api:4.11.0-157.v6852a_a_fa_ec11
openJDK-native-plugin:1.8
pam-auth:1.10
parameterized-scheduler:255.v73827fcdf618
parameterized-trigger:787.v665fcf2a_830b_
pipeline-aggregator-view:1.15
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-github:2.8-159.09e4403bc62f
pipeline-github-lib:42.v0739460cda_c4
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:689.veec561a_dee13
pipeline-input-step:477.v339683a_8d55e
pipeline-maven:1368.vfb_8509d7b_869
pipeline-maven-api:1368.vfb_8509d7b_869
pipeline-maven-database:1368.vfb_8509d7b_869
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2168.vf921b_4e72c73
pipeline-model-definition:2.2168.vf921b_4e72c73
pipeline-model-extensions:2.2168.vf921b_4e72c73
pipeline-multibranch-defaults:2.1
pipeline-npm:155.ve2e393062d86
pipeline-rest-api:2.34
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2168.vf921b_4e72c73
pipeline-stage-view:2.34
pipeline-utility-steps:2.16.0
plain-credentials:143.v1b_df8b_d3b_e48
plugin-usage-plugin:4.2
plugin-util-api:3.8.0
postbuild-task:1.9
postbuildscript:3.2.0-550.v88192b_d3e922
powershell:2.1
prism-api:1.29.0-10
prometheus:2.5.0
promoted-builds:945.v597f5c6a_d3fd
publish-over:0.22
publish-over-ftp:1.17
publish-over-ssh:1.25
pubsub-light:1.18
pyenv-pipeline:2.1.2
resource-disposer:0.23
role-strategy:689.v731678c3e0eb_
run-condition:1.7
saferestart:0.7
saml:4.429.v9a_781a_61f1da_
scm-api:683.vb_16722fb_b_80b_
script-security:1313.v7a_6067dc7087
scriptler:344.v5a_ddb_5f9e685
shiningpanda:0.24
simple-theme-plugin:176.v39740c03a_a_f5
snakeyaml-api:2.2-111.vc6598e30cc65
sse-gateway:1.26
ssh:2.6.1
ssh-agent:346.vda_a_c4f2c8e50
ssh-credentials:308.ve4497b_ccd8f4
ssh-slaves:2.947.v64ee6b_f87b_c1
ssh-steps:2.0.68.va_d21a_12a_6476
ssh2easy:1.6
sshd:3.312.v1c601b_c83b_0e
structs:325.vcb_307d2a_2782
swarm:3.44
terminate-ssh-processes-plugin:1.0
test-results-analyzer:0.4.1
test-stability:2.3
testng-plugin:835.v51ed3da_fcc35
text-finder:1.26
thinBackup:1.18
throttle-concurrents:2.14
timestamper:1.26
token-macro:400.v35420b_922dcb_
trilead-api:2.133.vfb_8a_7b_9c5dd1
uno-choice:2.8.1
vagrant:1.0.2
variant:60.v7290fc0eb_b_cd
view-job-filters:369.ve0513a_a_f5524
warnings-ng:10.6.0
workflow-aggregator:596.v8c21c963d92d
workflow-api:1283.v99c10937efcb_
workflow-basic-steps:1042.ve7b_140c4a_e0c
workflow-cps:3837.v305192405b_c0
workflow-durable-task-step:1313.vcb_970b_d2a_fb_3
workflow-job:1385.vb_58b_86ea_fff1
workflow-multibranch:770.v1a_d0708dd1f6
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:865.v43e78cc44e0d
ws-cleanup:0.45
xunit:3.1.3

Reproduction steps

I have job using Jenkinsfile script running some stages in parallel.
At the beginning of every stage it lock some resources.
However one stage fails (always second). Three others run fine. Other jobs (from different branches fails on other stages).

This problem was introduced with the update from lockable-resource plugin 1215.v895f61d7f794 version to 1224.v5e9500f98269 version.

Expected Results

No errors

Actual Results

[id=2528]        WARNING        h.ExpressionFactory2$JexlExpression#evaluate: Caught exception evaluating: it.getQueue() in /lockable-resources/. Reason: java.lang.NullPointerException: Cannot invoke "org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.get()" because "this.executionRef" is null
invoke "org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.get()" because "this.executionRef" is null
      at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getExecution(CpsStepContext.java:217)
      at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:242)
      at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:236)
      at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:293)
      at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:75)
      at org.jenkins.plugins.lockableresources.queue.QueuedContextStruct.getBuild(QueuedContextStruct.java:77)
      at org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction.getQueue(LockableResourcesRootAction.java:301)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      at org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
      at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
      at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
      at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
      at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
      at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
      at hudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:76)
      at org.apache.commons.jelly.tags.core.CoreTagLibrary$3.run(CoreTagLibrary.java:134)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:99)
      at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:172)
      at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:265)
      at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:101)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:101)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      at org.apache.commons.jelly.tags.core.OtherwiseTag.doTag(OtherwiseTag.java:41)
      at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:265)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      at org.apache.commons.jelly.tags.core.ChooseTag.doTag(ChooseTag.java:38)
      at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:265)
      at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:101)
      at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
      at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:265)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:122)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:101)
      at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
      at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:265)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:101)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:101)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:101)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:101)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:101)
      at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
      at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:265)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:122)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:122)
      at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:99)
      at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:66)
      at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:55)
      at org.kohsuke.stapler.jelly.ScriptInvoker.execute(ScriptInvoker.java:56)
      at org.kohsuke.stapler.jelly.ScriptInvoker.execute(ScriptInvoker.java:43)
      at org.kohsuke.stapler.Facet.handleIndexRequest(Facet.java:284)
      at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:104)
      at org.kohsuke.stapler.IndexViewDispatcher.dispatch(IndexViewDispatcher.java:32)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
      at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:698)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:248)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
      at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:163)
      at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:248)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:89)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at hudson.plugins.locale.LocaleFilter.doFilter(LocaleFilter.java:39)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:60)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215)
      at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:88)
      at org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:121)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at jenkins.util.HttpServletFilter$1.doFilter(HttpServletFilter.java:76)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:166)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at jenkins.ErrorAttributeFilter.doFilter(ErrorAttributeFilter.java:29)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:160)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:94)
      at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:54)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:110)
      at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)
      at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:63)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:111)
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:172)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:53)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:38)
      at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
      at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:569)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
      at org.eclipse.jetty.server.Server.handle(Server.java:563)
      at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
      at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
      at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
      at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
      at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
      at java.base/java.lang.Thread.run(Thread.java:833)

Anything else?

https://issues.jenkins.io/browse/JENKINS-72537

Are you interested in contributing a fix?

No response

@kaniapm kaniapm added the bug label Jan 10, 2024
@meeusen
Copy link
Contributor

meeusen commented Jan 10, 2024

We have the same problem. This is all I see (logging ALL of org.jenkins.plugins.lockableresources) after starting jenkins and loading the lockable resource page on Jenkins:

Jan 10, 2024 4:26:04 PM FINE org.jenkins.plugins.lockableresources.BackwardCompatibility compatibilityMigration
lockable-resources-plugin compatibility migration task run for 95 resources
Jan 10, 2024 4:26:04 PM INFO org.jenkins.plugins.lockableresources.NodesMirror createNodeResources
lockable-resources-plugin: configure node resources
Jan 10, 2024 4:26:04 PM FINE org.jenkins.plugins.lockableresources.FreeDeadJobs freePostMortemResources
lockable-resources-plugin free post mortem task run

I can reproduce it like this

  • reserve all resources of a specific label
  • start a pipeline job that tries to lock a resource with that label. This build ends up as a queuedContext in the XML
  • restart Jenkins (https://jenkins/restart)

When Jenkins starts up again, and after opening the lockable resources page, I get the NullPointerException. Also when starting the same job again, it fails with that NullPointerException.

Pipeline: Groovy (workflow-cps) Version 3837.v305192405b_c0
Lockable Resources Version 1222.v3d55a_36d63e4
Jenkins 2.426.2

@mPokornyETM
Copy link
Contributor

feel free to review changes in the related PR #609

@meeusen
Copy link
Contributor

meeusen commented Jan 11, 2024

I've tried the version of PR #609. Now the pipeline job waits for an available resource, but when I manually unreserve one of those resources, I still get the NullPointerException.

jenkins    | Caused by: java.lang.NullPointerException: Cannot invoke "org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.get()" because "this.executionRef" is null
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getExecution(CpsStepContext.java:217)
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:242)
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:236)
jenkins    | 	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:293)
jenkins    | 	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:75)
jenkins    | 	at org.jenkins.plugins.lockableresources.LockableResourcesManager.unreserve(LockableResourcesManager.java:961)
jenkins    | 	at org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction.doUnreserve(LockableResourcesRootAction.java:581)
jenkins    | 	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
jenkins    | 	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
jenkins    | 	... 116 more

When I make the same change at https://github.com/mPokornyETM/lockable-resources-plugin/blob/fix-possible-npe-in-get-queue/src/main/java/org/jenkins/plugins/lockableresources/LockableResourcesManager.java#L965 (catch all exceptions), then I can unreserve the resource again. So then there is one resource free, but the pipeline only continues after unreserving another resource, as unreserving the first time only tries to continue with the invalid queuedContext.

@mPokornyETM
Copy link
Contributor

because "this.executionRef" is null

strange, the exception "because "this.executionRef" is null" happens in other plugin. Not here, I tries just to cacht it. May we chat samewhere else. I need maybe some more configs ... , Because I have really no idea, how can I simulate it.

Or can you try to write test case in this branch, which can simulate the scenario?

@meeusen
Copy link
Contributor

meeusen commented Jan 11, 2024

Unfortunately, I can't reproduce it in a development environment, so I don't know what triggers the problem.

I can force it in a development environment by removing the "executionRef" element from a QueuedContextStruct in the XML. Not sure if this is useful for finding the actual problem though, but it seems to yield the same results in the lockable resources plugin.

    <org.jenkins.plugins.lockableresources.queue.QueuedContextStruct>
      <context class="org.jenkinsci.plugins.workflow.cps.CpsStepContext" plugin="workflow-cps@3832.vc43e04d6d68c">
        <executionRef class="flow-owner" plugin="workflow-job@1326.ve643e00e9220">
          <job>lock-resource-long-time</job>
          <id>60</id>
        </executionRef>
        <id>7</id>
        <bodyHeads/>
        <body class="org.jenkinsci.plugins.workflow.cps.HandleBodyReference">
          <id>5</id>
        </body>
        <threadId>4</threadId>
        <stepDescriptorId>org.jenkins.plugins.lockableresources.LockStep</stepDescriptorId>
      </context>
      <lockableResourcesStruct>
      ...
    </org.jenkins.plugins.lockableresources.queue.QueuedContextStruct>

@mPokornyETM
Copy link
Contributor

Thats too much hacking. I mean, when the xml file is broken, or other plugin throws unexpected exceptions, it is too hard to handle it here.
Anyway, I thinkg the proposed changes are OK. Because it does not matter, why the item can not be proceeded. It shall be removed from queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants