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

Pipeline's timeout takes twice the timeout to terminate HubotApprove

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • hubot-steps-plugin
    • None
    • Jenkins ver. 2.89.4
      Hubot Pipeline Steps 2.0.0

      If using hubotApprove inside timeout() in Jenkins (scripted) pipeline effective time it takes to terminate approve request seems to double;

      Example code:
      timestamps {
        timeout(time:15, unit:'SECONDS') {
          env.HUBOT_URL = Constants.HUBOT_URL
          hubotApprove message: "test message",
          room: '#jenkins-devel', submitter: 'mjuuti',
          failOnError: 'true'
         }
      }

      Console output:

      00:00:01.397 Timeout set to expire in 15 sec
      [Pipeline] {
      [Pipeline] hubotApprove
      00:00:01.409 Hubot: ROOM - #jenkins-devel - Approval Message - test message
      00:00:01.568 Hubot: Successful. Code: 200
      00:00:01.571 test message
      00:00:01.572 Proceed  or Abort
      00:00:16.397 Cancelling nested steps due to timeout
      00:00:31.397 Body did not finish within grace period; terminating with extreme prejudice

      e.g. 15 second timeout went off at 16 seconds but process was script body was forcibly terminated only after 15 seconds after that (2x timeout, tested with different values).

      This probably is bug in timeout plugin https://issues.jenkins-ci.org/browse/JENKINS-40839

      But I suppose on improvement side in this plugin try/catch could check first if catch org.jenkinsci.plugins.workflow.steps.FlowInterruptedException (or probably any standard 'abort' exception) has been thrown and then terminate immediately.

      My domain knowledge is minimal at best and Java isn't strong with this one either but I suppose https://github.com/jenkinsci/hubot-steps-plugin/blob/master/src/main/java/org/thoughtslive/jenkins/plugins/hubot/service/HubotService.java#L57 might be the culprit by catching all exceptions and not throwing?

      This happens with both failOnError as 'true' or 'false'

            nrayapati Naresh Rayapati
            mjuuti Markus Juuti
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: