Moodle
  1. Moodle
  2. MDL-7344

Adding metacourses can fail due to 10 second time limit

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7, 1.8
    • Fix Version/s: 1.7, 1.7.1, 1.8
    • Component/s: Course
    • Labels:
      None
    • Environment:
      Postgres 8.1, slow development server
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE
    • Rank:
      27821

      Description

      Create a course with 5,000 students. Now create a metacourse. Add the 5k-student course to the metacourse.

      After 10 seconds, depending on whether you have debug turned on or not, either you get an error message about time limit running out, or the page loads entirely blank. (Hrm. That's helpful!)

      This is caused because adding students to a course takes longer under the new role system. The old timeouts were intended presumably to avoid the risk of timeout (since the timeout is 10 seconds per course) but in fact they cause one. A 5,000 user course on our slow development hardware takes approximately 2 minutes to transfer in current stable moodle.

      In case it's useful, here's some hacky code that (on a test server you don't care about) makes 5,000 students on the course:

      <?php
      require_once('config.php');

      set_time_limit(0);

      // Add 5k users to course 2
      $course=get_record('course','id',2);
      if(!$course) {
      error('No 1');
      }
      for($i=1;$i<=5000;$i++) {
      $user=new StdClass;
      $user->username="User$i";
      $user->firstname="First$i";
      $user->lastname="Last$i";
      if(!insert_record('user',$user))

      { error('No 2'); }

      if(!enrol_into_course($course,$user,'manual'))

      { error('No 3'); }


      if($i%100 == 0)

      { print "<p>$i</p>"; }

      }
      ?>

        Activity

        Hide
        Sam Marshall added a comment -

        I have checked in a change to HEAD and STABLE (the latter of which I probably shouldn't have done, sorry, may need to back out to achieve release) that 'fixes' this by altering the timeout to 180 seconds.

        Show
        Sam Marshall added a comment - I have checked in a change to HEAD and STABLE (the latter of which I probably shouldn't have done, sorry, may need to back out to achieve release) that 'fixes' this by altering the timeout to 180 seconds.

          People

          • Assignee:
            Sam Marshall
            Reporter:
            Sam Marshall
            Tester:
            Nobody
            Participants:
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: