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

Add the possibility to enforce timeout (add forcible parameter)

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have a java.util.concurrent.LinkedBlockingQueue<Step>() which holds every step for my build pipeline. I also have a variable count of workers that call a getWork() method to get one of those steps. getWork() looks like:

      Step getWork() {
        if (Data.stepQueue.size() == 0) {
          return null
        }
      
        Step work
        try {
          timeout(time: 10, unit: 'SECONDS') {
            work = Data.stepQueue.take()
          }
        } catch (e) {
          echo "Pipeline Warning: Could not take new element of stepQueue. Worker may shut down now..."
          return null
        }
      
        if (!work.readyToRun) {
          Data.stepQueue.put(work)
          return getWork()
        }
        return work
      }
      

      I put a timeout around the take() call, because there might not be enough work at the end. The issue is, that killing this takes much longer than it should.

      I checked the source code and there is already a forcible attribute. It would be great to pass a value by calling timeout like this:

      timeout(forcible: true, time: 10, unit: 'SECONDS') {
        data.take()
      }

      Please add the possibility to enforce this.

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              ctwx Christian Wansart
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: