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

Edge case affecting redis sessions

    XMLWordPrintable

Details

    • MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • Hide

      Prerequisite is a working redis installation available on localhost.

      Add

      define('TEST_SESSION_REDIS_HOST', '127.0.0.1');
      $CFG->session_handler_class = '\core\session\redis';
      $CFG->session_redis_host = '127.0.0.1';
      $CFG->session_redis_acquire_lock_timeout = 120;
      $CFG->session_redis_lock_expire = 7200;
      

      To config.php

      Set up phpunit and run:
      vendor/bin/phpunit lib/tests/session_redis_test.php

      To verify that there are no regressions.

      Then download the forked_redis_sessions.php script from this issue and put it in dataroot and then run it as apache user:

      sudo -u www-data php path/to/moodle/forked_redis_sessions.php

      Show
      Prerequisite is a working redis installation available on localhost. Add define( 'TEST_SESSION_REDIS_HOST' , '127.0.0.1' ); $CFG->session_handler_class = '\core\session\redis' ; $CFG->session_redis_host = '127.0.0.1' ; $CFG->session_redis_acquire_lock_timeout = 120 ; $CFG->session_redis_lock_expire = 7200 ; To config.php Set up phpunit and run: vendor/bin/phpunit lib/tests/session_redis_test.php To verify that there are no regressions. Then download the forked_redis_sessions.php script from this issue and put it in dataroot and then run it as apache user: sudo -u www-data php path/to/moodle/forked_redis_sessions.php

    Description

      We recently had an issue with a client where students were getting booted out of the LMS and getting a "Exception - Redis went away" error especially when doing quizzes affecting about less than 0.0001% of requests. We narrowed it down to a potential edge case bug in the phpredis module detailed here.

      A potential workaround is just to have the session retry the connection and that seems to work within the first retry (confirmed with unit tests).

      Attachments

        Issue Links

          Activity

            People

              marcusboon Marcus Boon
              marcusboon Marcus Boon
              Damyon Wiese Damyon Wiese
              Andrew Lyons Andrew Lyons
              Ryan Wyllie Ryan Wyllie
              Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Jan/18