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

lib/accesslib.php causes php to crash while executing: cache_context() - [patch]

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.5, 1.9.6, 1.9.7, 1.9.8, 1.9.9, 2.0
    • Fix Version/s: 1.9.11
    • Component/s: Libraries, Performance
    • Environment:
      moodle 1.9.5+ (Version: May 27th 2009), PHP Version 5.2.9, Apache Version 2.2.11, eAccelerator Version 0.9.5.3
    • Database:
      PostgreSQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Since updating from m194+ to m1.9.5+ (Version: May 27th 2009), under heavy traffic, we observed (initially) php crashes while executing: "cache_context($context);" (see logs below) leading to continuously dying apache instances right after birth. As a result pages aren't fully served any more, logged in useres can't perform any course/context related actions any more (well, at least nothing)....and moodle is completely messed-up. A graceful apache restart is sufficient to come back to a defined operation level.

      To Reproduce:
      On our development server i tried hard to reproduce such a state.... and therefore this seems to be a little bit "unrealistic" usecase:
      0. in php.ini set "max_execution_time" to some useless short priod of time, e.g. 10 sec.
      1. Set the myMoodle redirect after login as default ( admin/settings.php?section=mymoodle ) // mymoodleredirect
      2. Set the maximum number of courses for the myMoodle site to.... something huge... e.g. 300 // mycoursesperpage
      3. Check out an user having many, many courses.... e.g. 200 (or create one: simply by assigning an user e.g. as teacher within a category with 200+ courses)
      4. Login in as this particular user... "start using moodle", and my be two or three more...
      5. watch your apache und php logs......

      Obervation:
      lib/accesslib.php will be terminated due to the exceed of the maximum execution time.... and voila, here's the mess....
      ... in best cases logged in useres accessing their myMoodle Site will see "No course information to show"

      Workaround:
      1. Limit the maximum number of courses for the myMoodle site to: 21 (default) - 50 ? // mycoursesperpage
      2. raise the "max_execution_time" in php.ini to 60+++ sec.
      ------------------------------------------------------------------------------------------------------------------------------------------------
      Logs:
      php_log
      [25-Jun-2009 11:27:11] PHP Fatal error: Maximum execution time of 60 seconds exceeded in <docroot>/moodle/lib/accesslib.php on line 2538
      [25-Jun-2009 11:29:34] PHP Fatal error: Maximum execution time of 60 seconds exceeded in<docroot>/moodle/lib/accesslib.php on line 182
      [25-Jun-2009 11:31:01] PHP Fatal error: Maximum execution time of 60 seconds exceeded in <docroot>/moodle/lib/accesslib.php on line 2538

      error_log
      [8814] EACCELERATOR: PHP crashed on opline 17 of round() at <docroot>/moodle/mod/forum/lib.php:2264
      [Thu Jun 25 11:31:31 2009] [notice] child pid 8814 exit signal Floating point exception (8)

      access_log
      "nothing uncommon"...... normal usage......
      ------------------------------------------------------------------------------------------------------------------------------------------------
      This issue may be related to:
      http://tracker.moodle.org/browse/MDL-18768
      http://tracker.moodle.org/browse/MDL-19288

        Gliffy Diagrams

          Attachments

          1. accesslib.cache.2.patch
            14 kB
          2. accesslib.php.patch
            5 kB
          3. lib.php.patch
            3 kB
          4. MDL-19702-demo.php
            2 kB
          5. myCourses.png
            myCourses.png
            9 kB

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    21/Feb/11