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

Timeout occurence inside a retry step wont cancel the latter

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • Jenkins 2.27 workflow-basic-steps-plugin 2.2

      having a code such as:

      node('master') {
        timeout (10) {
          retry(2) {
            try {
              sh "while true; do; sleep 2; done"
            } catch (e) {
              echo "wont ever run as theres no exception coming out from the timeout"
            }
          }
        }
      }
      

      leds to the first retry to end due a (supposedly) internal exception being thrown but go on with the second one.

      Shouldnt timeouts forbid retrying? Besides, timeouts won't throw an exception as the last echo won't ever happen

          [JENKINS-39266] Timeout occurence inside a retry step wont cancel the latter

          Javier Delgado created issue -
          Jesse Glick made changes -
          Description Original: having a code such as:

          node('master') {
            timeout (10) {
              retry(2) {
                try {
                  sh "while true; do; sleep 2; done"
                } catch (e) {
                  echo "wont ever run as theres no exception coming out from the timeout"
                }
              }
            }
          }

          leds to the first retry to end due a (supposedly) internal exception being thrown but go on with the second one.

          Shouldnt timeouts forbid retrying? Besides, timeouts won't throw an exception as the last echo won't ever happen
          New: having a code such as:

          {code}
          node('master') {
            timeout (10) {
              retry(2) {
                try {
                  sh "while true; do; sleep 2; done"
                } catch (e) {
                  echo "wont ever run as theres no exception coming out from the timeout"
                }
              }
            }
          }
          {code}

          leds to the first retry to end due a (supposedly) internal exception being thrown but go on with the second one.

          Shouldnt timeouts forbid retrying? Besides, timeouts won't throw an exception as the last echo won't ever happen

          Jesse Glick added a comment -

          As of JENKINS-39072, if the body fails to terminate within a given period of time—for example, because you have caught the timeout exception and decided to continue—after a grace period the body will be forcibly killed.

          In this case it is better to put retry outside timeout rather than inside.

          Jesse Glick added a comment - As of JENKINS-39072 , if the body fails to terminate within a given period of time—for example, because you have caught the timeout exception and decided to continue—after a grace period the body will be forcibly killed. In this case it is better to put retry outside timeout rather than inside.
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-39072 [ JENKINS-39072 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            Unassigned Unassigned
            witokondoria Javier Delgado
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: