Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39134

com.google.inject.CreationException after resuming build in script {} or withMaven {}

    XMLWordPrintable

Details

    Description

      I use a build pipeline to execute several maven tasks. My pipeline code looks like this example:

      stage("checkout git") {
         // .....
      }
      
      stage("build app") {
        node {
          withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
            sh 'mvn clean install'
        }
      }
      
      stage("deploy app") {
         node {
           withMaven(maven:'Maven_3_3_9', mavenLocalRepo: '.repository',mavenSettingsConfig:'my-config') {
             sh 'mvn deploy'
         }
      }
      

      If i use the "Safe Restart Plugin" or the "Prepare for Restart Option" and restart the Jenkins the pipeline will crash when the next maven task in the pipeline is executed and throws the following error.

      [Pipeline] {
      [Pipeline] withMaven
      [Pipeline] // withMaven
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] End of Pipeline
      hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:
      
      1) A just-in-time binding to org.jenkinsci.plugins.pipeline.maven.WithMavenStep was already configured on a parent injector.
        at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)
      
      1 error
      	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
      	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
      	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
      	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
      	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
      	at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
      	at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
      	at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
      	at maven.call(/var/lib/jenkins/jobs/jndiagent-INTEGRATION/builds/27/libs/com.timocom.jenkins.pipeline/vars/maven.groovy:22)
      	at WorkflowScript.run(WorkflowScript:44)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:48)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Finished: FAILURE
      

      All the documentations say that pipeline jobs are resilient to Jenkins restarts but it seems that there is a problem with the maven enviroment created by the "withMavenStep".

      Attachments

        Issue Links

          Activity

            I found out that other jobs using the "withMaven" step will also fail untill I restart the Jenkins again. Maybe the maven environment not cleaned up properly?

            henok Hendrik Brinkmann added a comment - I found out that other jobs using the "withMaven" step will also fail untill I restart the Jenkins again. Maybe the maven environment not cleaned up properly?

            The problem still exists but i found a workaround and posted this workaround to stackoverflow:

            http://stackoverflow.com/questions/40169667/jenkins-pipeline-plugin-withmaven-step-leads-to-com-google-inject-creationexce/40399441#40399441

            henok Hendrik Brinkmann added a comment - The problem still exists but i found a workaround and posted this workaround to stackoverflow: http://stackoverflow.com/questions/40169667/jenkins-pipeline-plugin-withmaven-step-leads-to-com-google-inject-creationexce/40399441#40399441
            jglick Jesse Glick added a comment -

            Steps to reproduce from scratch? Content of vars/maven.groovy?

            jglick Jesse Glick added a comment - Steps to reproduce from scratch? Content of vars/maven.groovy ?
            henok Hendrik Brinkmann added a comment - - edited

            I wrote a global function called maven() to simplfy maven tasks. The groovy code and the log may not fit together but I testet the maven task without my global function to eliminate errros caused by the global function and the error occurs independent of the use of global functions.

            henok Hendrik Brinkmann added a comment - - edited I wrote a global function called maven() to simplfy maven tasks. The groovy code and the log may not fit together but I testet the maven task without my global function to eliminate errros caused by the global function and the error occurs independent of the use of global functions.

            Not sure that this issue is related to Maven.
            I'm able to reproduce this kind of error in a non Maven environment. Please let me know if another issue needs to be created.

            My environment : Jenkins 2.19.2 (inside docker official image), workflow-aggregator=2.4, pipeline-model-definition=0.5

            Steps to reproduce :

            • Create a pipeline like this one :
            #!/usr/bin/env groovy
            
            pipeline {
            	
            	agent any
            
            	stages {
            		stage("build") {
            			steps {
            				echo "Building my super project"
            				script {
            					for(int i=0; i < 9; i++) {
            						sleep 10
            						echo "Building step ${i}"
            					}
            				}
            			}
            		}
            	}
            }
            
            • Trigger a build of this pipeline and restart Jenkins (in my case, with http://myjenkins:8080/restart" and 'yes') when the pipeline is inside the "for" loop.
            • When restarted, Jenkins resumes the build normally and it ends in success state.
            • Then, if you replay the previous build, it fails with this stacktrace :
            Running on master in /var/jenkins_home/workspace/test
            [Pipeline] {
            [Pipeline] stage
            [Pipeline] { (build)
            [Pipeline] echo
            Building my super project
            [Pipeline] script
            [Pipeline] // script
            [Pipeline] echo
            Error in stages execution: Guice creation errors:
            
            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.modeldefinition.steps.ScriptStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)
            
            1 error
            [Pipeline] }
            [Pipeline] // stage
            [Pipeline] }
            [Pipeline] // node
            [Pipeline] End of Pipeline
            hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors:
            
            1) A just-in-time binding to org.jenkinsci.plugins.pipeline.modeldefinition.steps.ScriptStep was already configured on a parent injector.
              at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37)
            
            1 error
            	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
            	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
            	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
            	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
            	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237)
            	at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110)
            	at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43)
            	at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
            	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
            	at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
            	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:151)
            	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
            	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
            	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
            	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
            	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
            	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
            	at WorkflowScript.run(WorkflowScript:11)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:105)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:201)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:104)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.toolsBlock(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:255)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:102)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:263)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:101)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:228)
            	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:99)
            	at ___cps.transform___(Native Method)
            	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
            	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
            	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
            	at sun.reflect.GeneratedMethodAccessor109.invoke(Unknown Source)
            	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            	at java.lang.reflect.Method.invoke(Method.java:498)
            	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
            	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
            	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
            	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
            	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
            	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
            	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
            	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
            	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
            	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
            	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
            	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
            	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
            	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            	at java.lang.Thread.run(Thread.java:745)
            Finished: FAILURE
            

            A Jenkins restart solves the issue.

            Note : I'm not able to reproduce without the Jenkins Pipeline Directives style. For example, this pipeline doesn't seem to be affected by this issue in my case :

            #!/usr/bin/env groovy
            
            stage("build") {
            	
            	echo "Building my super project"
                    for(int i=0; i < 9; i++) {
            	    sleep 10
            	    echo "Building step ${i}"
            	}
            	
            }
            
            mpapo Michael Pailloncy added a comment - Not sure that this issue is related to Maven. I'm able to reproduce this kind of error in a non Maven environment. Please let me know if another issue needs to be created. My environment : Jenkins 2.19.2 (inside docker official image), workflow-aggregator=2.4, pipeline-model-definition=0.5 Steps to reproduce : Create a pipeline like this one : #!/usr/bin/env groovy pipeline { agent any stages { stage( "build" ) { steps { echo "Building my super project" script { for ( int i=0; i < 9; i++) { sleep 10 echo "Building step ${i}" } } } } } } Trigger a build of this pipeline and restart Jenkins (in my case, with http://myjenkins:8080/restart " and 'yes') when the pipeline is inside the "for" loop. When restarted, Jenkins resumes the build normally and it ends in success state. Then, if you replay the previous build, it fails with this stacktrace : Running on master in / var /jenkins_home/workspace/test [Pipeline] { [Pipeline] stage [Pipeline] { (build) [Pipeline] echo Building my super project [Pipeline] script [Pipeline] // script [Pipeline] echo Error in stages execution: Guice creation errors: 1) A just-in-time binding to org.jenkinsci.plugins.pipeline.modeldefinition.steps.ScriptStep was already configured on a parent injector. at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37) 1 error [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline hudson.remoting.ProxyException: com.google.inject.CreationException: Guice creation errors: 1) A just-in-time binding to org.jenkinsci.plugins.pipeline.modeldefinition.steps.ScriptStep was already configured on a parent injector. at org.jenkinsci.plugins.workflow.steps.ContextParameterModule.configure(ContextParameterModule.java:37) 1 error at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107) at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230) at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:237) at jenkins.ProxyInjector.createChildInjector(ProxyInjector.java:110) at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.prepareInjector(AbstractStepImpl.java:43) at org.jenkinsci.plugins.workflow.steps.AbstractStepImpl.start(AbstractStepImpl.java:36) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:182) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108) at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source) 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:151) at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16) at WorkflowScript.run(WorkflowScript:11) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:105) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:201) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:104) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.toolsBlock(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:255) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:102) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:263) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:101) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:228) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/ var /jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:99) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82) at sun.reflect.GeneratedMethodAccessor109.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46) at com.cloudbees.groovy.cps.Next.step(Next.java:58) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang. Thread .run( Thread .java:745) Finished: FAILURE A Jenkins restart solves the issue. Note : I'm not able to reproduce without the Jenkins Pipeline Directives style. For example, this pipeline doesn't seem to be affected by this issue in my case : #!/usr/bin/env groovy stage( "build" ) { echo "Building my super project" for ( int i=0; i < 9; i++) { sleep 10 echo "Building step ${i}" } }
            henok Hendrik Brinkmann added a comment - - edited

            I did not use the Pipeline Directives style explicitly but the error although occurs. Did you test this scenario in a pipeline job or in a free style job? I used the pipeline job template.

            henok Hendrik Brinkmann added a comment - - edited I did not use the Pipeline Directives style explicitly but the error although occurs. Did you test this scenario in a pipeline job or in a free style job? I used the pipeline job template.

            henok => both tests a on a pipeline job.

            Moreover, I noticed that this error occurred both with a "Replay" of a the previous resumed build or with a simple new "Build" of the job.

            mpapo Michael Pailloncy added a comment - henok => both tests a on a pipeline job. Moreover, I noticed that this error occurred both with a "Replay" of a the previous resumed build or with a simple new "Build" of the job.
            jglick Jesse Glick added a comment -

            Probably AbstractStepImpl should just deleted; Guice is far more hassle than it is worth. TBD where the error lies; needs debugger work.

            jglick Jesse Glick added a comment - Probably AbstractStepImpl should just deleted; Guice is far more hassle than it is worth. TBD where the error lies; needs debugger work.

            After upgrading following plugins the exception occurs

            Pipeline: Milestone Step -> From 1.1 to 1.2
            Pipeline: REST API Plugin -> From 2.2 to 2.3
            Pipeline: Stage View Plugin -> 2.2 to 2.3

            When downgrading all works fine again.

            two Thomas Wöckinger added a comment - After upgrading following plugins the exception occurs Pipeline: Milestone Step -> From 1.1 to 1.2 Pipeline: REST API Plugin -> From 2.2 to 2.3 Pipeline: Stage View Plugin -> 2.2 to 2.3 When downgrading all works fine again.
            jglick Jesse Glick added a comment -

            two it is unlikely any of those plugins are involved; were there other dependencies you upgraded/downgraded?

            jglick Jesse Glick added a comment - two it is unlikely any of those plugins are involved; were there other dependencies you upgraded/downgraded?

            Defently not, and it is reproduceable. I can try if it is possible find out if it is only one or two of the given dependencies.

            two Thomas Wöckinger added a comment - Defently not, and it is reproduceable. I can try if it is possible find out if it is only one or two of the given dependencies.

            I reduced it to the Pipeline Milestone Step Plugin: If i upgrade it to 1.2 the build fails, after downgrade all works as excpected

            two Thomas Wöckinger added a comment - I reduced it to the Pipeline Milestone Step Plugin: If i upgrade it to 1.2 the build fails, after downgrade all works as excpected

            Can confirm, Downgrading makes it work again. Thank for the "workaround"

            eernie Erwin Oldenkamp added a comment - Can confirm, Downgrading makes it work again. Thank for the "workaround"
            jglick Jesse Glick added a comment -

            Seems implausible that these changes could have triggered such a bug; maybe just tickled something else.

            jglick Jesse Glick added a comment - Seems implausible that these changes could have triggered such a bug; maybe just tickled something else.
            jglick Jesse Glick added a comment -

            ScriptStepExecution is wrong; missing optional=true. So I suspect that is the cause of the bug in pipeline-model-definition (I will try to confirm via functional test). But WithMavenStepExecution seems to do this right. Is it known how to reproduce with withMaven?

            jglick Jesse Glick added a comment - ScriptStepExecution is wrong; missing optional=true . So I suspect that is the cause of the bug in pipeline-model-definition (I will try to confirm via functional test). But WithMavenStepExecution seems to do this right. Is it known how to reproduce with withMaven ?

            jglick I think you're right. I didn't see it at first but my problem was with the script tag of the pipeline-model-definition

            eernie Erwin Oldenkamp added a comment - jglick I think you're right. I didn't see it at first but my problem was with the script tag of the pipeline-model-definition
            jglick Jesse Glick added a comment -

            Without JENKINS-34488, you get a more opaque error message.

            jglick Jesse Glick added a comment - Without JENKINS-34488 , you get a more opaque error message.
            jglick Jesse Glick added a comment -

            I found what these two steps have in common but is unique to them: they are block-scoped, the execution injects the step, and the step has a no-argument constructor. Apparently this makes Guice blow up. Reproduced in a minimal test in workflow-step-api and looking into the root cause.

            jglick Jesse Glick added a comment - I found what these two steps have in common but is unique to them: they are block-scoped, the execution injects the step, and the step has a no-argument constructor. Apparently this makes Guice blow up. Reproduced in a minimal test in workflow-step-api and looking into the root cause.
            jglick Jesse Glick added a comment -

            Could not find a way to make AbstractStepExecutionImpl work in such cases. Considering deprecating it.

            jglick Jesse Glick added a comment - Could not find a way to make AbstractStepExecutionImpl work in such cases. Considering deprecating it.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pipeline-model-definition/pom.xml
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/4912a56312a45cf58dab1d0f5e4227ab9bb9fc00
            Log:
            Updating workflow-api dep to pick up JENKINS-34488 fix, making JENKINS-39134 easier to track.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pipeline-model-definition/pom.xml http://jenkins-ci.org/commit/pipeline-model-definition-plugin/4912a56312a45cf58dab1d0f5e4227ab9bb9fc00 Log: Updating workflow-api dep to pick up JENKINS-34488 fix, making JENKINS-39134 easier to track.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStep.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStepTest.java
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/bb3b9c27dd15eef9980aa296278a836767344bbd
            Log:
            JENKINS-39134 Avoiding Guice error by not injecting ScriptStep (which was unused anyway).

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStep.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStepTest.java http://jenkins-ci.org/commit/pipeline-model-definition-plugin/bb3b9c27dd15eef9980aa296278a836767344bbd Log: JENKINS-39134 Avoiding Guice error by not injecting ScriptStep (which was unused anyway).

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-api/src/main/resources/index.jelly
            pipeline-model-declarative-agent/src/main/resources/index.jelly
            pipeline-model-definition/pom.xml
            pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStep.java
            pipeline-model-definition/src/main/resources/index.jelly
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStepTest.java
            pipeline-stage-tags-metadata/src/main/resources/index.jelly
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/e27901b50fb3896820cdb843060e5a922a4b6127
            Log:
            Merge pull request #59 from jglick/CreationException-JENKINS-39134

            JENKINS-39134 Fix CreationException when resuming inside script {}

            Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/87add2604c94...e27901b50fb3

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-api/src/main/resources/index.jelly pipeline-model-declarative-agent/src/main/resources/index.jelly pipeline-model-definition/pom.xml pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStep.java pipeline-model-definition/src/main/resources/index.jelly pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/steps/ScriptStepTest.java pipeline-stage-tags-metadata/src/main/resources/index.jelly http://jenkins-ci.org/commit/pipeline-model-definition-plugin/e27901b50fb3896820cdb843060e5a922a4b6127 Log: Merge pull request #59 from jglick/CreationException- JENKINS-39134 JENKINS-39134 Fix CreationException when resuming inside script {} Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/87add2604c94...e27901b50fb3

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java
            src/test/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepTest.java
            http://jenkins-ci.org/commit/pipeline-maven-plugin/a2729547dc0c545043ad882e48b8de60623490db
            Log:
            JENKINS-39134 Workaround for Pipeline/Guice bug.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java src/test/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepTest.java http://jenkins-ci.org/commit/pipeline-maven-plugin/a2729547dc0c545043ad882e48b8de60623490db Log: JENKINS-39134 Workaround for Pipeline/Guice bug.

            Code changed in jenkins
            User: Alvaro Lobato
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStep.java
            src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java
            src/main/resources/index.jelly
            src/test/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepTest.java
            http://jenkins-ci.org/commit/pipeline-maven-plugin/0fbb0d2e553eae676519b496918aaf54621345a7
            Log:
            Merge pull request #11 from jglick/CreationException-JENKINS-39134

            JENKINS-39134 Work around Guice problem

            Compare: https://github.com/jenkinsci/pipeline-maven-plugin/compare/a1bd50adb05f...0fbb0d2e553e

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alvaro Lobato Path: pom.xml src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStep.java src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java src/main/resources/index.jelly src/test/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepTest.java http://jenkins-ci.org/commit/pipeline-maven-plugin/0fbb0d2e553eae676519b496918aaf54621345a7 Log: Merge pull request #11 from jglick/CreationException- JENKINS-39134 JENKINS-39134 Work around Guice problem Compare: https://github.com/jenkinsci/pipeline-maven-plugin/compare/a1bd50adb05f...0fbb0d2e553e

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReader.java
            http://jenkins-ci.org/commit/workflow-support-plugin/ddadc4b61b4b438946550e530f18c1b3b47cc46a
            Log:
            JENKINS-39134 Mechanism to allow tests to intercept program.dat deserialization.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReader.java http://jenkins-ci.org/commit/workflow-support-plugin/ddadc4b61b4b438946550e530f18c1b3b47cc46a Log: JENKINS-39134 Mechanism to allow tests to intercept program.dat deserialization.

            People

              jglick Jesse Glick
              henok Hendrik Brinkmann
              Votes:
              3 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: