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

PeriodicWork can block timer thread; use ScheduledExecutorService instead



    • Similar Issues:


      A buggy plugin can block the Jenkins timer thread. This will prevent slave provisioning (NodeProvisionerInvoker) from running, among many other problems.

      AsyncPeriodicWork is designed for this purpose and should be used if fast execution cannot be guaranteed. Nonetheless, Jenkins core should defend against plugins with slow tasks (disk I/O, network) which fail to use it and use PeriodicWork instead; or which have an extension which is called from within a core PeriodicWork, such as a Trigger, and fail to spawn a thread for their body.

      It would be better to deprecate Trigger.timer (which unfortunately still leaves a useless TimerThread lying around) and switch to a ScheduledExecutorService, which allows concurrency in case one task has not finished by the time the next is ready to run.

      It would also be useful to have an administrative monitor which reports non-async PeriodicWork implementations that are taking "too long", defined either as still being running when the next task is ready to go, or which are taking more than e.g. 10% of their defined recurrence period, etc.


          Issue Links


            jglick Jesse Glick created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue is blocking JENKINS-19123 [ JENKINS-19123 ]
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Labels performance threads lts-candidate performance threads
            olivergondza Oliver Gond┼ża made changes -
            Labels lts-candidate performance threads 1.532.2-fixed performance threads
            jglick Jesse Glick made changes -
            Assignee recampbell [ recampbell ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 151139 ] JNJira + In-Review [ 193801 ]


              recampbell Ryan Campbell
              jglick Jesse Glick
              0 Vote for this issue
              3 Start watching this issue