• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • pipeline
    • None

      The issue occours if you have a "Multibranch Pipeline" job that takes some time such as:

      pipeline {
          agent any
          
          stages {
               stage('only'){
                  steps {
                      checkout scm
                      sh 'sleep 300'
                  }
              }
          }
      }

          
      This gets automatically detected by the pipeline and executed. This can also be kicked off manually by going into the job and clicking the run button beside the branch (e.g. 'master'). If this button is pushed twice in succession (or two branches are committed at the same time) two instances of the job will run. If there is a single build executor that these jobs can run on (I have only seen this when the executor is separate from the "master" node), the first will start running. The second will do some pipeline action to identify what needs to be run, but then wait in the queue for the first job to complete. Once the first job has completed the second job will run to completion. For the above job, the first job will show as taking the appropriate five minutes. However, the second job will show as taking ten minutes....it is including the time it was waiting for an executor! If this is done with many jobs, the time will include all the time that each job had to wait in the queue. When looking at the historical builds, it will look like it took ten minutes to execute even though it was five of waiting and five of executing. This will also affect the projected build time for the next job run.

      This also shows "10 minutes building on an executor" if the metrics plugin is installed.

      The solution to this is to not include the time spent waiting for an executor in the build time recorded. I believe the matrix jobs had a similar issue that was fixed in Issue #8112.

          [JENKINS-46569] Job execution time includes waiting time

          Thomas Kent created issue -
          Daniel Daehler made changes -
          Issue Type Original: Improvement [ 4 ] New: Bug [ 1 ]
          Thomas de Grenier de Latour made changes -
          Description Original: The issue occours if you have a "Multibranch Pipeline" job that takes some time such as:


          {code:java}
          pipeline {
              agent any
              
              stages {
                  stage('only'){
                      steps {
                          checkout scm
                          sh 'sleep 300'
                      }
                  }
              }
          }{code}

              
          This gets automatically detected by the pipeline and executed. This can also be kicked off manually by going into the job and clicking the run button beside the branch (e.g. 'master'). If this button is pushed twice in succession (or two branches are committed at the same time) two instances of the job will run. If there is a single build executor that these jobs can run on (I have only seen this when the executor is separate from the "master" node), the first will start running. The second will do some pipeline action to identify what needs to be run, but then wait in the queue for the first job to complete. Once the first job has completed the second job will run to completion. For the above job, the first job will show as taking the appropriate five minutes. However, the second job will show as taking ten minutes....it is including the time it was waiting for an executor! If this is done with many jobs, the time will include all the time that each job had to wait in the queue. When looking at the historical builds, it will look like it took ten minutes to execute even though it was five of waiting and five of executing. This will also affect the projected build time for the next job run.

          This also shows "10 minutes building on an executor" if the metrics plugin is installed.

          The solution to this is to not include the time spent waiting for an executor in the build time recorded. I believe the matrix jobs had a similar issue that was fixed in Issue #8112.
          New: The issue occours if you have a "Multibranch Pipeline" job that takes some time such as:
          {code:java}
          pipeline {
              agent any
              
              stages {
                   stage('only'){
                      steps {
                          checkout scm
                          sh 'sleep 300'
                      }
                  }
              }
          }{code}
              
           This gets automatically detected by the pipeline and executed. This can also be kicked off manually by going into the job and clicking the run button beside the branch (e.g. 'master'). If this button is pushed twice in succession (or two branches are committed at the same time) two instances of the job will run. If there is a single build executor that these jobs can run on (I have only seen this when the executor is separate from the "master" node), the first will start running. The second will do some pipeline action to identify what needs to be run, but then wait in the queue for the first job to complete. Once the first job has completed the second job will run to completion. For the above job, the first job will show as taking the appropriate five minutes. However, the second job will show as taking ten minutes....it is including the time it was waiting for an executor! If this is done with many jobs, the time will include all the time that each job had to wait in the queue. When looking at the historical builds, it will look like it took ten minutes to execute even though it was five of waiting and five of executing. This will also affect the projected build time for the next job run.

          This also shows "10 minutes building on an executor" if the metrics plugin is installed.

          The solution to this is to not include the time spent waiting for an executor in the build time recorded. I believe the matrix jobs had a similar issue that was fixed in Issue #8112.
          Roy made changes -
          Priority Original: Minor [ 4 ] New: Blocker [ 1 ]
          Mark Waite made changes -
          Comment [ If possible, consider configuring more executors on your Jenkins instance so that parallel builds can run simultaneously. This will reduce the time spent waiting in the queue. If you have certain jobs that need to be prioritized over others, you can set job priorities or adjust the job scheduling strategy to ensure that the most important jobs are run first. Look into Jenkins plugins that may help with scheduling and queuing of jobs, such as the Throttle Concurrent Builds plugin. This plugin can help control the number of concurrent builds running and waiting. Consider separating the execution environment for jobs. For example, by using different nodes for different branches or projects, you can isolate jobs from each other and reduce queuing times. The metrics plugin and other build time tracking tools may need to be adjusted to account for the queue time separately from the execution time. Check the settings or configuration options for the plugins you are using to see if there are ways to customize the metrics.  ]
          Naveen Boni made changes -
          Description Original: The issue occours if you have a "Multibranch Pipeline" job that takes some time such as:
          {code:java}
          pipeline {
              agent any
              
              stages {
                   stage('only'){
                      steps {
                          checkout scm
                          sh 'sleep 300'
                      }
                  }
              }
          }{code}
              
           This gets automatically detected by the pipeline and executed. This can also be kicked off manually by going into the job and clicking the run button beside the branch (e.g. 'master'). If this button is pushed twice in succession (or two branches are committed at the same time) two instances of the job will run. If there is a single build executor that these jobs can run on (I have only seen this when the executor is separate from the "master" node), the first will start running. The second will do some pipeline action to identify what needs to be run, but then wait in the queue for the first job to complete. Once the first job has completed the second job will run to completion. For the above job, the first job will show as taking the appropriate five minutes. However, the second job will show as taking ten minutes....it is including the time it was waiting for an executor! If this is done with many jobs, the time will include all the time that each job had to wait in the queue. When looking at the historical builds, it will look like it took ten minutes to execute even though it was five of waiting and five of executing. This will also affect the projected build time for the next job run.

          This also shows "10 minutes building on an executor" if the metrics plugin is installed.

          The solution to this is to not include the time spent waiting for an executor in the build time recorded. I believe the matrix jobs had a similar issue that was fixed in Issue #8112.
          New: The issue occours if you have a "Multibranch Pipeline" job that takes some time such as:
          {code:java}
          pipeline {
              agent any
              
              stages {
                   stage('only'){
                      steps {
                          checkout scm
                          sh 'sleep 300'
                      }
                  }
              }
          }{code}
              
          This gets automatically detected by the pipeline and executed. This can also be kicked off manually by going into the job and clicking the run button beside the branch (e.g. 'master'). If this button is pushed twice in succession (or two branches are committed at the same time) two instances of the job will run. If there is a single build executor that these jobs can run on (I have only seen this when the executor is separate from the "master" node), the first will start running. The second will do some pipeline action to identify what needs to be run, but then wait in the queue for the first job to complete. Once the first job has completed the second job will run to completion. For the above job, the first job will show as taking the appropriate five minutes. However, the second job will show as taking ten minutes....it is including the time it was waiting for an executor! If this is done with many jobs, the time will include all the time that each job had to wait in the queue. When looking at the historical builds, it will look like it took ten minutes to execute even though it was five of waiting and five of executing. This will also affect the projected build time for the next job run.

          This also shows "10 minutes building on an executor" if the metrics plugin is installed.

          The solution to this is to not include the time spent waiting for an executor in the build time recorded. I believe the matrix jobs had a similar issue that was fixed in Issue #8112.

            Unassigned Unassigned
            teeks99 Thomas Kent
            Votes:
            60 Vote for this issue
            Watchers:
            61 Start watching this issue

              Created:
              Updated: