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

$CFG->debugsessionlock reports lock times for read-only sessions

XMLWordPrintable

    • MOODLE_403_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-80281_401_STABLE
    • MDL-80281_403_STABLE
    • MDL-80281_main
    • Hide
      1. Set `$CFG->enable_read_only_sessions = true;` in config.php.
        • You may get an exception about cache mappings. If so, disable the above setting and follow these steps:
          1. Go /cache/admin.php
          2. Under "Installed cache stores", find "File cache" and click "Add instance
          3. Set store name to "Session cache", Cache path to "/tmp/session" and click "Auto create directory". Save changes
          4. At the bottom of the page, under "Stores used when no mapping is present", click "Edit mappings"
          5. Set "Session" to "Session cache".
          6. Log out and close your browser (or open a new browser/private window).
          7. Add `$CFG->enable_read_only_sessions = true;` in config.php and load the site again. You should no longer see an exception message.
      2. Set `$CFG->debugsessionlock = 0.1;` in config.php.
      3. Open a terminal and tail your server's error log. For example:

        tail -f /var/log/apache2/error.log
        

      4. Go to /admin/settings.php?section=manageantiviruses on your Moodle site. This page includes an AJAX request to the core_check_get_result_admintree external function, which has `readonlysession` set to true.
      5. Check the file that PHP error logs are written to.
        • Confirm that it does not contain a message like a message like " Debugging: Script /lib/ajax/service.php?sesskey=xxx&info=core_check_get_result_admintree locked the session for 0.458 seconds, it should close the session using \core\session\manager::write_close()". This confirms that debugging is not triggered for read-only sessions.
      6. Visit /admin/tool/generator/maketestcourse.php
        • Confirm that the page contains a message like "Script /admin/tool/generator/maketestcourse.php locked the session for 0.604 seconds, it should close the session using \core\session\manager::write_close()." This confirms that debugging is still working for locked sessions.
      Show
      Set `$CFG->enable_read_only_sessions = true;` in config.php. You may get an exception about cache mappings. If so, disable the above setting and follow these steps: Go /cache/admin.php Under "Installed cache stores", find "File cache" and click "Add instance Set store name to "Session cache", Cache path to "/tmp/session" and click "Auto create directory". Save changes At the bottom of the page, under "Stores used when no mapping is present", click "Edit mappings" Set "Session" to "Session cache". Log out and close your browser (or open a new browser/private window). Add `$CFG->enable_read_only_sessions = true;` in config.php and load the site again. You should no longer see an exception message. Set `$CFG->debugsessionlock = 0.1;` in config.php. Open a terminal and tail your server's error log. For example: tail -f /var/log/apache2/error .log Go to /admin/settings.php?section=manageantiviruses on your Moodle site. This page includes an AJAX request to the core_check_get_result_admintree external function, which has `readonlysession` set to true. Check the file that PHP error logs are written to. Confirm that it does not contain a message like a message like " Debugging: Script /lib/ajax/service.php?sesskey=xxx&info=core_check_get_result_admintree locked the session for 0.458 seconds, it should close the session using \core\session\manager::write_close()". This confirms that debugging is not triggered for read-only sessions. Visit /admin/tool/generator/maketestcourse.php Confirm that the page contains a message like "Script /admin/tool/generator/maketestcourse.php locked the session for 0.604 seconds, it should close the session using \core\session\manager::write_close()." This confirms that debugging is still working for locked sessions.

      Steps to reproduce:

      • Set `$CFG->enable_read_only_sessions = true;` in config.php.
      • Set `$CFG->debugsessionlock = 0.1;` in config.php. This will log a message for any session lock that is held for more than 100ms.
      • Go to /admin/settings.php?section=manageantiviruses on your Moodle site. This page includes an AJAX request to the core_check_get_result_admintree external function, which has `readonlysession` set to true.
      • Check the file that PHP error logs are written to. It will contain a message like " Debugging: Script /lib/ajax/service.php?sesskey=xxx&info=core_check_get_result_admintree locked the session for 0.458 seconds, it should close the session using \core\session\manager::write_close()". This is despite the fact that it never locked the session.

      This is due to there being no check in core\session\manager::start_session() to check the $requireslock parameter before setting $PERF->sessionlock['gained'].

            marxjohnson Mark Johnson
            marxjohnson Mark Johnson
            Marcus Green Marcus Green
            Jun Pataleta Jun Pataleta
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 35 minutes
                2h 35m

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