Moodle
  1. Moodle
  2. MDL-27481

Prevent profiling data to be sent to DB on installation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: Libraries, Performance
    • Environment:
      xhprof installed and enabled in config.php installing from scratch.
    • Database:
      Any
    • Testing Instructions:
      Hide

      Complexity: high

      Requirements: xhprof php extension enabled, hacking abilities and install new sites.

      Steps:

      • Proceed with the installation of one moodle 2.1dev site.
      • Once config.php is available, add these settings to it in order to guarantee that profiling runs will happen always:

      $CFG->earlyprofilingenabled = true;
      $CFG->profilingautofrec = 1;
      $CFG->profilingincluded = '/*view.php,/*index.php';
      $CFG->profilingallowme = true;
      $CFG->profilingallowall = true;

      • TEST1: Without the patch, error happens consistently, related to profiling_stop() not being able to save information to DB.
      • TEST2: With the patch, the installation goes along all its pages and ends normally (because no DB operation is performed until the table exists).

      Note1: You can perform TEST1 by hacking lib/xhprof/xhprof_moodle.php and changing this line:

      if (!in_array('profiling', $tables)) {

      by this:

      if (1== 2 and !in_array('profiling', $tables)) {

      (that invalidates the test so the old behavior - TEST1 - can be tested)

      Note2: Don't forget to delete the hack done for TEST1 in order to check TEST2 properly, hehe

      Show
      Complexity: high Requirements: xhprof php extension enabled, hacking abilities and install new sites. Steps: Proceed with the installation of one moodle 2.1dev site. Once config.php is available, add these settings to it in order to guarantee that profiling runs will happen always: $CFG->earlyprofilingenabled = true; $CFG->profilingautofrec = 1; $CFG->profilingincluded = '/*view.php,/*index.php'; $CFG->profilingallowme = true; $CFG->profilingallowall = true; TEST1: Without the patch, error happens consistently, related to profiling_stop() not being able to save information to DB. TEST2: With the patch, the installation goes along all its pages and ends normally (because no DB operation is performed until the table exists). Note1: You can perform TEST1 by hacking lib/xhprof/xhprof_moodle.php and changing this line: if (!in_array('profiling', $tables)) { by this: if (1== 2 and !in_array('profiling', $tables)) { (that invalidates the test so the old behavior - TEST1 - can be tested) Note2: Don't forget to delete the hack done for TEST1 in order to check TEST2 properly, hehe
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      prevent_profiling_before_install
    • Rank:
      17273

      Description

      Right now, although highly improbable in real sites, it is possible to enable and configure profiling runs from the config.php.

      When the profiling run ends, it sends results to database ('profiling' table). And it can be missing on early installation stages.

      The fix simply checks if the table already exists, guarantying that no database operation will happen if missing.

        Activity

        Hide
        Sam Hemelryk added a comment -

        Thanks Eloy - integrated now

        Show
        Sam Hemelryk added a comment - Thanks Eloy - integrated now
        Hide
        Glenn Ansley added a comment -

        Wow. Ok. I think the longest part of that test was getting xhprof installed on my testing server and then getting to the point where I could reproduce the errors. All said and done though, the integration works. No more errors (and i have xhprof installed on my server now as a bonus!)

        Show
        Glenn Ansley added a comment - Wow. Ok. I think the longest part of that test was getting xhprof installed on my testing server and then getting to the point where I could reproduce the errors. All said and done though, the integration works. No more errors (and i have xhprof installed on my server now as a bonus!)
        Hide
        Eloy Lafuente (stronk7) added a comment -

        This has been sent to upstream, many thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - This has been sent to upstream, many thanks!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: