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

Improve the readonly session debugging message

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1) Tail the logs:

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

      2) Download the attached file - MDL-68608-readonly-debugging.php - and put it in your site root.

      3) Access the file and confirm there are no errors or exceptions in the tailed logs

      4) Enable debugging and reload MDL-68608-readonly-debugging.php

      5) Confirm that you do see errors showing what would have been written in the session (again, in the tailed logs)

      6) Turn off debugging (set it to 'Normal' or disabled entirely), and set this in config.php:

      $CFG->enable_read_only_sessions_debug = true;

      7) Check the tailed logs and confirm that you do see errors showing what would have been written in the session, eg

      Script /cache/admin.php defined READ_ONLY_SESSION but the following SESSION attributes were changed: $SESSION->cachestore_session

      8) Now fully turn on readonly sessions:

      $CFG->enable_read_only_sessions = true;

      At the moment the session cache is still stored in the session which is incompatible with readonly sessions, so this should be a hard failure.

      9) Confirm that any page load results in an exception and the UI shows the red error box hard kills the whole site, and explains clearly what is wrong and how to fix it.

      10) Confirm this exception is shown on all pages, eg home / dashboard

      11) Disable readonly session (via config.php) so the site works again

      12) Visit the cache admin page (/cache/admin.php) and configure a redis cache store instance:

      https://docs.moodle.org/310/en/Redis_cache_store

      You can very simply run redis like so:

      docker run --net=host -d redis 

      Then you'll need to create an instance of the redis cache store via the /cache/admin.php page. Use 'localhost' for the server and leave everything else default.

      13) Scroll down to the end of the cache configuration page and click 'Edit mappings'. Change the session from default to use redis

      14) To flush all the session caches logout or kill all sessions:

      php admin/cli/kill_all_sessions.php

      15) Now re-enable readonly sessions again:

      $CFG->enable_read_only_sessions = true;

      16) Confirm that the site homepage now loads and does not throw an exception or emit any debugging

      Show
      1) Tail the logs: tail -f /var/log/apache2/error.log 2) Download the attached file - MDL-68608 -readonly-debugging.php - and put it in your site root. 3) Access the file and confirm there are no errors or exceptions in the tailed logs 4) Enable debugging and reload  MDL-68608 -readonly-debugging.php 5) Confirm that you do see errors showing what would have been written in the session (again, in the tailed logs) 6) Turn off debugging (set it to 'Normal' or disabled entirely), and set this in config.php: $CFG->enable_read_only_sessions_debug = true; 7) Check the tailed logs and confirm that you do see errors showing what would have been written in the session, eg Script /cache/admin.php defined READ_ONLY_SESSION but the following SESSION attributes were changed: $SESSION->cachestore_session 8) Now fully turn on readonly sessions: $CFG->enable_read_only_sessions = true; At the moment the session cache is still stored in the session which is incompatible with readonly sessions, so this should be a hard failure. 9) Confirm that any page load results in an exception and the UI shows the red error box hard kills the whole site, and explains clearly what is wrong and how to fix it. 10) Confirm this exception is shown on all pages, eg home / dashboard 11) Disable readonly session (via config.php) so the site works again 12) Visit the cache admin page (/cache/admin.php) and configure a redis cache store instance: https://docs.moodle.org/310/en/Redis_cache_store You can very simply run redis like so: docker run --net=host -d redis Then you'll need to create an instance of the redis cache store via the /cache/admin.php page. Use 'localhost' for the server and leave everything else default. 13) Scroll down to the end of the cache configuration page and click 'Edit mappings'. Change the session from default to use redis 14) To flush all the session caches logout or kill all sessions: php admin/cli/kill_all_sessions.php 15) Now re-enable readonly sessions again: $CFG->enable_read_only_sessions = true; 16) Confirm that the site homepage now loads and does not throw an exception or emit any debugging
    • Affected Branches:
      MOODLE_311_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull 3.11 Branch:
      MDL-68608-improve-readonly-debugging-MOODLE_311_STABLE
    • Pull Master Branch:
      MDL-68608-improve-readonly-debugging

      Description

      The warning when a page mutates the session doesn't quite have enough info in it to be useful. In theory every instance of this debugging call should end up as a new tracker so we want the error message to be reasonably verbose and contain everything we need to create a tracker and trace down the problem.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brendanheywood Brendan Heywood
              Reporter:
              brendanheywood Brendan Heywood
              Peer reviewer:
              Dmitrii Metelkin Dmitrii Metelkin
              Integrator:
              Jake Dallimore Jake Dallimore
              Tester:
              Janelle Barcega Janelle Barcega
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h