Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-80924

Ad Hoc Task Queue can become filled with a single class of task

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1.6
    • Tasks
    • None
    • MOODLE_401_STABLE

      In the code, for running Ad Hoc tasks, there is the following comment (lib/classes/task/manager.php line 680) :

       
      /*

      • The maximum number of cron runners that an individual task is allowed to use.
      • For example if the concurrency limit is 20 and there are 5 unique types of tasks
      • in the queue, each task should not be allowed to consume more than 3 (i.e., ⌊20/6⌋).
      • The + 1 is needed to prevent the queue from becoming full of only one type of class.
      • i.e., if it wasn't there and there were 20 tasks of the same type in the queue, every
      • runner would become consumed with the same (potentially long-running task) and no more
      • tasks can run. This way, some resources are always available if some new types
      • of tasks enter the queue.
        *
      • We use the short-ternary to force the value to 1 in the case when the number of tasks
      • exceeds the runners (e.g., there are 8 tasks and 4 runners, ⌊4/(8+1)⌋ = 0).
        */
         
        This is all very sensible - it stop a single class of Ad Hoc task from filling the queue, making sure there is always space for a new task which is added to the queue to run. But then three comments down, line 732, it says:
         
        /*
      • If this happens that means each task has consumed its fair share of capacity, but there's still
      • runners left over (and we are one of them). Fetch tasks without checking slot limits.
        */
         
        This completely undoes the concept of leaving space for new tasks. If there are any runners left from the above code, meant for any new tasks which are added, this bit of the code fills them with the same, potentially long-running task.
         

            Unassigned Unassigned
            DavidNorman99 David Norman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.