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

cron runs 12+hours accessing MySQL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.9
    • Labels:
      None
    • Environment:
      Solaris 8, Apache 2.0.59, PHP 4.4.7, APC 3.0.14, MySQL 5.0.41 on Sun V890, 16GB ram. Moodle 1.8+ from 5/23/07 tarball, recently upgraded from 1.6.5+
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Twice now since I upgraded to 1.8+ a week ago, I have found that cron begins a long-running task at (say) 3:30 AM and it is still running later in the day(12 hours+). The MySQL daemon is consuming at least one whole CPU.I have run a mytop display to see what sort of queries were being made,and it seems be mainly one
      like this:
      SELECT COUNT(DISTINCT prs.userid) FROM (SELECT ra.userid, ra.roleid AS primary_roleid, ra.contextid, r.sortorder, r.name, r.description, r.shortname, c.instanceid AS courseid, c.contextlevel FROM mdl_role_assignments ra INNER JOIN mdl_role r ON ra.roleid = r.id INNER JOIN mdl_context c ON ra.contextid = c.id WHERE NOT EXISTS ( SELECT 1 FROM mdl_role_assignments i_ra INNER JOIN mdl_role i_r ON i_ra.roleid = i_r.id WHERE ra.userid = i_ra.userid AND ra.contextid = i_ra.contextid AND i_r.sortorder < r.sortorder ) ) prs WHERE prs.primary_roleid=3 AND prs.courseid=3279 AND prs.contextlevel = 50 ...................

      What is this all about? I am tempted to kill the php process but since it is the weekend and we are between semesters, I'll let it run for a while longer!

      I should mention that I have observed the lack of some table indexes that are present when 1.8 is installed outright, rather than upgraded. The list seems to be the same as described for Moodle 1.7. Is this a factor?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              jpd James Dugal
              Tester:
              Nobody
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08