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

Task cleanup Redis cache fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.0.6, 4.1.1
    • 4.0.5, 4.1
    • Caching
    • Moodle 4.1 running on Redhat 8, PHP 8.0, Apache 2.4, Redis 5 and MariaDB 10.5.
      Two Redis instances, one on port 6379 (MUC) and one on port 6380 (Session) on the same server.
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-76218-master
    • Hide
      1. Start a Redis container

        docker run --name redis -p 6379:6379 redis
        

      2. Navigate to Site admin -> Plugins -> Caching -> Configuration
      3. Add a new Redis instance entering:
        1. Store name: MDL-76218
        2. Server: localhost
      4. Set the default mappings so that this cache is used for all session and application caches (bottom of the page)
      5. Open cache/stores/redis/lib.php in your preferred editor
      6. Find the function definition for delete_many()
      7. Inside the if (!$keys) check and before return 0; add a call to error log, for example::

                if (!$keys) {
                    error_log("Exiting early!");
                    return 0;
                }
        

      8. Run the scheduled task \cachestore_redis\task\ttl at least twice in a row:

        php admin/cli/scheduled_task.php --execute="\cachestore_redis\task\ttl"
        php admin/cli/scheduled_task.php --execute="\cachestore_redis\task\ttl"
        

        1. Confirm that there were no errors
        2. Confirm that you see the "Exiting early!" notices (possibly only on the second run)
        3. Confirm that on the second run in particular (possibly hte first run too) you see: "Deleted 0 key(s) in 0.01s"
      Show
      Start a Redis container docker run --name redis -p 6379:6379 redis Navigate to Site admin -> Plugins -> Caching -> Configuration Add a new Redis instance entering: Store name: MDL-76218 Server: localhost Set the default mappings so that this cache is used for all session and application caches (bottom of the page) Open cache/stores/redis/lib.php in your preferred editor Find the function definition for delete_many() Inside the if (!$keys) check and before return 0; add a call to error log, for example:: if (!$keys) { error_log("Exiting early!"); return 0; } Run the scheduled task \cachestore_redis\task\ttl at least twice in a row: php admin/cli/scheduled_task.php --execute="\cachestore_redis\task\ttl" php admin/cli/scheduled_task.php --execute="\cachestore_redis\task\ttl" Confirm that there were no errors Confirm that you see the "Exiting early!" notices (possibly only on the second run) Confirm that on the second run in particular (possibly hte first run too) you see: "Deleted 0 key(s) in 0.01s"

      I have a Moodle 4.1 environment running on Redhat 8, PHP 8.0, Apache 2.4, Redis 5 and MariaDB 10.5
      I configured two Redis instances, one on port 6379  (MUC) and one on port 6380 (Session) on the same server.
      This configuration runs fine.

      I see problems with this new admin task of Redis, the task doesn't work and fails with errors:

      Maak geheugen vrij dat gebruikt wordt door verlopen items in de Redis cache\cachestore_redis\task\ttl Rediscachestore_redis     Thursday, 20 October 2022, 07:57 Thursday, 3 November 2022, 15:15 57 * * * * 480Wis Ja

      In the tasks logs I see these errors:

      Execute scheduled task: Maak geheugen vrij dat gebruikt wordt door verlopen items in de Redis cache (cachestore_redis\task\ttl) ... started 15:02:02. Current memory use 4.5 MB. Debugging increased temporarily due to faildelay of 120 core/capabilities: ... used 0 dbqueries ... used 0.0090029239654541 seconds
       Scheduled task failed:
       Maak geheugen vrij dat gebruikt wordt door verlopen items in de Redis cache (cachestore_redis\task\ttl),
       Wrong parameter count for Redis::zRem() Backtrace:
       * line 445 of /cache/stores/redis/lib.php: call to Redis->zRem()
       * line 611 of /cache/stores/redis/lib.php: call to cachestore_redis->delete_many()
       * line 75 of /cache/stores/redis/classes/task/ttl.php: call to cachestore_redis->expire_ttl()
       * line 259 of /lib/cronlib.php: call to cachestore_redis\task\ttl->execute()
       * line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
       * line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
       * line 178 of /admin/cli/cron.php: call to cron_run()
      

            quen Sam Marshall
            alainraap Alain Raap
            Katie Ransom Katie Ransom
            Andrew Lyons Andrew Lyons
            Carlos Escobedo Carlos Escobedo
            Votes:
            0 Vote for this issue
            Watchers:
            8 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.