jenkinsci / concurrent-step-plugin

Jenkins plugin to use utils in Java concurrent package.
https://plugins.jenkins.io/concurrent-step/
MIT License
21 stars 8 forks source link

java.lang.IllegalStateException: countDownLatch step must be called with a body #17

Open jspam opened 3 years ago

jspam commented 3 years ago

Version report

Jenkins and plugins versions report:

Jenkins: 2.263.4
OS: Linux - 4.15.0-130-generic
---
gradle:1.36
credentials-binding:1.24
external-monitor-job:1.7
bootstrap4-api:4.6.0-2
momentjs:1.1.1
dtkit-api:3.0.0
workflow-aggregator:2.6
git:4.6.0
jjwt-api:0.11.2-9.c8b45b8bb173
file-operations:1.11
git-server:1.9
workflow-basic-steps:2.22
timestamper:1.11.8
ssh-slaves:1.31.5
xunit:2.3.9
docker-java-api:3.1.5.2
bouncycastle-api:2.20
lockable-resources:2.10
docker-workflow:1.26
plain-credentials:1.7
resource-disposer:0.15
mapdb-api:1.0.9.0
mailer:1.32.1
analysis-model-api:9.8.1
subversion:2.14.0
script-security:1.76
forensics-api:1.0.0
git-parameter:0.9.13
pipeline-rest-api:2.19
echarts-api:5.0.1-1
pipeline-build-step:2.13
github:1.33.1
matrix-auth:2.6.5
credentials:2.3.15
branch-api:2.6.2
jsch:0.1.55.2
workflow-api:2.41
pipeline-stage-tags-metadata:1.8.4
ansicolor:0.7.5
pipeline-model-extensions:1.8.4
workflow-support:3.8
pipeline-input-step:2.12
apache-httpcomponents-client-4-api:4.5.13-1.0
ldap:1.26
git-client:3.6.0
font-awesome-api:5.15.2-2
scm-api:2.6.4
checks-api:1.5.0
workflow-step-api:2.23
workflow-cps:2.90
ace-editor:1.1
jdk-tool:1.5
command-launcher:1.5
Parameterized-Remote-Trigger:3.1.5.1
pipeline-model-definition:1.8.4
pipeline-stage-view:2.19
workflow-scm-step:2.12
ws-cleanup:0.39
http_request:1.8.27
pipeline-model-declarative-agent:1.1.1
pipeline-model-api:1.8.4
htmlpublisher:1.25
jquery-detached:1.2.1
structs:1.22
email-ext:2.82
workflow-cps-global-lib:2.18
pipeline-graph-analysis:1.10
ant:1.11
workflow-durable-task-step:2.38
build-timeout:1.20
github-branch-source:2.9.7
pam-auth:1.6
antisamy-markup-formatter:2.1
junit:1.48
windows-slaves:1.7
github-api:1.123
snakeyaml-api:1.27.0
jquery:1.12.4-1
data-tables-api:1.10.23-3
concurrent-step:1.0.0
warnings-ng:8.10.0
plugin-util-api:2.0.0
okhttp-api:3.14.9
trilead-api:1.0.13
handlebars:1.1.1
workflow-multibranch:2.22
greenballs:1.15.1
display-url-api:2.3.4
jackson2-api:2.12.1
pipeline-milestone-step:1.3.2
token-macro:2.13
workflow-job:2.40
pipeline-stage-step:2.5
jquery3-api:3.5.1-3
durable-task:1.35
cloudbees-folder:6.15
pipeline-github-lib:1.0
authentication-tokens:1.4
docker-plugin:1.2.2
docker-commons:1.17
popper-api:1.16.1-2
jaxb:2.3.0.1
matrix-project:1.18
ssh-credentials:1.18.1

Debian 10

Reproduction steps

Results

Expected result:

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] createLatch
[Pipeline] parallel
[Pipeline] { (Branch: wait)
[Pipeline] { (Branch: countdown1)
[Pipeline] { (Branch: countdown2)
[Pipeline] awaitLatch
[Pipeline] sleep
Sleeping for 3 sec
[Pipeline] sleep
Sleeping for 2 sec
[Pipeline] countDownLatch
[Pipeline] }
[Pipeline] countDownLatch
[Pipeline] echo
var1=true
[Pipeline] echo
var2=true
[Pipeline] }
[Pipeline] }
[Pipeline] // parallel
[Pipeline] End of Pipeline
[Checks API] No suitable checks publisher found.
Finished: SUCCESS

Actual result:

The pipeline will hang and after aborting display a backtrace

java.lang.IllegalStateException: countDownLatch step must be called with a body
    at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:246)
    at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
    at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
    at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
    at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
    at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
    at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
    at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
    at WorkflowScript.run(WorkflowScript:20)
    at ___cps.transform___(Native Method)
...

More info

This pipeline used to work fine. I upgraded from Jenkins 2.249.2 to 2.263.4; it still worked. Then I upgraded all the plugins, which caused this error. However, there were a lot of plugins and I don't have the exact versions.

Emmy-github-webdev commented 1 year ago

I am having the same error. Any solution?

ismail062 commented 1 year ago

I had this issue but the syntax was not correct. Check the syntax, maybe brackets are missing. Another reason could be update in plugin and call method.