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

timeout around input does not work with submitter

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • Jenkins ver. 1.651.3 (also 2.7.4)
      Pipeline: Basic Steps 2.1
      Pipeline: Input Step 2.1

      The example from https://jenkins.io/doc/pipeline/

      timeout(time:5, unit:'DAYS') {
          input message:'Approve deployment?', submitter: 'it-ops'
      }
      

      does not work.
      I tested with a shorter timeout and as soon as i added an submitter the input stays for ever open. without submitter the input is correctly terminated.

          [JENKINS-38380] timeout around input does not work with submitter

          Jesse Glick added a comment -

          Smells like a regression from the fix of JENKINS-37154 to me. canCancel() should have been true if running as SYSTEM; need to check it.

          Jesse Glick added a comment - Smells like a regression from the fix of JENKINS-37154 to me. canCancel() should have been true if running as SYSTEM ; need to check it.

          Seems to run as anonymous and has no Job.CANCEL Permission.

          Authentication authentication = Jenkins.getAuthentication();
          GrantedAuthority[] authorities = authentication.getAuthorities();
          

          contains only [anonymous]

          Thomas Kalmár added a comment - Seems to run as anonymous and has no Job.CANCEL Permission. Authentication authentication = Jenkins.getAuthentication(); GrantedAuthority[] authorities = authentication.getAuthorities(); contains only [anonymous]

          The check inside canCancel seems to be ok.

          getRun().getParent().hasPermission(ACL.SYSTEM, Job.CANCEL)
          

          returns true, perhaps the problem is in the basic step not calling the cancel with SYSTEM-Authorization?

          Thomas Kalmár added a comment - The check inside canCancel seems to be ok. getRun().getParent().hasPermission(ACL.SYSTEM, Job.CANCEL) returns true, perhaps the problem is in the basic step not calling the cancel with SYSTEM-Authorization?

          Jesse Glick added a comment -

          Reproduced an error

          … jenkins.util.ErrorLoggingScheduledThreadPoolExecutor afterExecute
          WARNING: failure in task not wrapped in SafeTimerTask
          hudson.model.Failure: You need to be '…' (or have Job CANCEL permissions) to cancel this.
          	at org.jenkinsci.plugins.workflow.support.steps.input.InputStepExecution.preAbortCheck(InputStepExecution.java:215)
          	at org.jenkinsci.plugins.workflow.support.steps.input.InputStepExecution.doAbort(InputStepExecution.java:196)
          	at org.jenkinsci.plugins.workflow.support.steps.input.InputStepExecution$1.run(InputStepExecution.java:91)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
          	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
          	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)
          

          which may be what you are talking about. When updating Pipeline: Basic Steps to 2.3, the error is still printed, though in that case the timeout does work, due I think to some fix from JENKINS-39072/JENKINS-34637.

          Jesse Glick added a comment - Reproduced an error … jenkins.util.ErrorLoggingScheduledThreadPoolExecutor afterExecute WARNING: failure in task not wrapped in SafeTimerTask hudson.model.Failure: You need to be '…' (or have Job CANCEL permissions) to cancel this. at org.jenkinsci.plugins.workflow.support.steps.input.InputStepExecution.preAbortCheck(InputStepExecution.java:215) at org.jenkinsci.plugins.workflow.support.steps.input.InputStepExecution.doAbort(InputStepExecution.java:196) at org.jenkinsci.plugins.workflow.support.steps.input.InputStepExecution$1.run(InputStepExecution.java:91) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) 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) which may be what you are talking about. When updating Pipeline: Basic Steps to 2.3, the error is still printed, though in that case the timeout does work, due I think to some fix from JENKINS-39072 / JENKINS-34637 .

          I can confirm, that the bug is fixed with Basic Steps 2.3 The timeout cancels the build, but i can approve the input afterwards. Should i fill another bug about that?

          Thomas Kalmár added a comment - I can confirm, that the bug is fixed with Basic Steps 2.3 The timeout cancels the build, but i can approve the input afterwards. Should i fill another bug about that?

          Jesse Glick added a comment -

          No need; update to Pipeline: Input Step 2.4, with the actual fix of this issue.

          Jesse Glick added a comment - No need; update to Pipeline: Input Step 2.4, with the actual fix of this issue.

          Digant Patel added a comment -

          Hi,

          When I upgraded to Pipeline: Input Step 2.4, I am getting below error.
          It seems Pipeline is not able to find "input" DSL keyword, I checked on Snippet Generator, it is missing there as well.

          java.lang.NoSuchMethodError: No such DSL method 'input' found among [archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, emailextrecipients, error, fileExists, findFiles, getContext, isUnix, load, mail, milestone, node, parallel, properties, pwd, readFile, readManifest, readMavenPom, readProperties, readTrusted, retry, sh, sleep, splitTests, stage, stash, step, svn, timeout, timestamps, tool, touch, unarchive, unstash, unzip, waitUntil, withContext, withEnv, wrap, writeFile, writeMavenPom, ws, zip]
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:109)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:113)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1144)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1038)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:723)
          at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:44)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1144)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1038)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
          at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
          at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
          at WorkflowScript.run(WorkflowScript:140)
          at __cps.transform__(Native Method)
          at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:55)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
          at sun.reflect.GeneratedMethodAccessor448.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
          at sun.reflect.GeneratedMethodAccessor466.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
          at sun.reflect.GeneratedMethodAccessor466.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
          at sun.reflect.GeneratedMethodAccessor466.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
          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.CpsThread.runNextChunk(CpsThread.java:164)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:297)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:78)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:206)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:204)
          at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          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:471)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
          Finished: FAILURE

          Digant Patel added a comment - Hi, When I upgraded to Pipeline: Input Step 2.4 , I am getting below error. It seems Pipeline is not able to find "input" DSL keyword, I checked on Snippet Generator, it is missing there as well. java.lang.NoSuchMethodError: No such DSL method 'input' found among [archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, emailextrecipients, error, fileExists, findFiles, getContext, isUnix, load, mail, milestone, node, parallel, properties, pwd, readFile, readManifest, readMavenPom, readProperties, readTrusted, retry, sh, sleep, splitTests, stage, stash, step, svn, timeout, timestamps, tool, touch, unarchive, unstash, unzip, waitUntil, withContext, withEnv, wrap, writeFile, writeMavenPom, ws, zip] at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:109) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:113) at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1144) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1038) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:723) at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:44) at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1144) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1038) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15) at WorkflowScript.run(WorkflowScript:140) at __ cps.transform __(Native Method) at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:55) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79) at sun.reflect.GeneratedMethodAccessor448.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55) at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45) at sun.reflect.GeneratedMethodAccessor466.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55) at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45) at sun.reflect.GeneratedMethodAccessor466.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55) at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45) at sun.reflect.GeneratedMethodAccessor466.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) 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.CpsThread.runNextChunk(CpsThread.java:164) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:297) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:78) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:206) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:204) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47) at java.util.concurrent.FutureTask.run(FutureTask.java:262) 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:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Finished: FAILURE

          Jesse Glick added a comment -

          I know, already fixed, get 2.5.

          Jesse Glick added a comment - I know, already fixed, get 2.5.

            jglick Jesse Glick
            thomas_kalmar Thomas Kalmár
            Votes:
            7 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: