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

Edge case affecting redis sessions

    XMLWordPrintable

    Details

    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      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

              Assignee:
              marcusboon Marcus Boon
              Reporter:
              marcusboon Marcus Boon
              Peer reviewer:
              Damyon Wiese
              Integrator:
              Andrew Nicols
              Tester:
              Ryan Wyllie
              Participants:
              Component watchers:
              Matteo Scaramuccia, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jan/18