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

The "\core\task\stats_cron_task" scheduled task gets stuck in large sites

    XMLWordPrintable

Details

    Description

      Recently, scheduled task \core\task\stats_cron_task was found running in a transaction with the following SQL statment not completing in a reasonable time:

      INSERT INTO mdl_temp_stats_daily (stattype, timeend, courseid, roleid, stat1, stat2) SELECT 'activity', 1664460000 AS timeend, courseid, roleid, SUM(statsreads), SUM(statswrites) FROM (
      SELECT pl.courseid, pl.roleid, sud.statsreads, sud.statswrites FROM mdl_temp_stats_user_daily sud, ( SELECT DISTINCT te.userid, te.roleid, te.courseid FROM mdl_temp_enroled te WHERE te.roleid <> 19 AND te.userid <> 1 ) pl WHERE sud.userid = pl.userid AND sud.courseid = pl.courseid AND sud.timeend = 1664460000 AND sud.stattype='activity' ) inline_view GROUP BY courseid, roleid HAVING SUM(statsreads) > 0 OR SUM(statswrites) > 0;

      The transaction was held open for 4 days and this caused severe issues related to database performance.

      Attachments

        1. MDL-75907_testing.png
          MDL-75907_testing.png
          44 kB
        2. MDL-75907_v311.png
          MDL-75907_v311.png
          37 kB
        3. MDL-75907_v400.png
          MDL-75907_v400.png
          38 kB

        Activity

          People

            mikhailgolenkov Misha Golenkov
            mikhailgolenkov Misha Golenkov
            Dmitrii Metelkin Dmitrii Metelkin
            Victor Déniz Falcón Victor Déniz Falcón
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 35 minutes
                35m

                Clockify

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