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

Exception - Unknown named parameter $read_timeout after MDL-66151

XMLWordPrintable

    • MOODLE_405_STABLE
    • MOODLE_405_STABLE
    • MDL-83085-main
    • Hide

      Setup requirements

      • During the unit testing, if enabled, please disable the Xdebug on your PHP CLI config.
      • PHPRedis: https://github.com/phpredis/phpredis
      • The testings use two types of connection, Redis standalone and Redis cluster. Each connection uses a different docker image.

      Note

      1. This bug needs to be tested with 2 versions of PHPRedis: 5.3.7 and 6.0.2
      2. To install PHPRedis with a specific version, do as below:
        1. git clone https://github.com/phpredis/phpredis.git
        2. cd phpredis
        3. git checkout tags/[Target_Version] -b [Target_Version]
        4. phpize
        5. ./configure
        6. make && make install
        7. Add extension=redis.so to your php.ini file
        8. Restart PHP and Apache/Nginx service

      Redis standalone // Session

      1. Open config.php and add the below codes: 

        define(
          'TEST_SESSION_REDIS_HOST',
          '127.0.0.1:6380'
        );

      2. VERIFY all the tests in lib/tests/session/redis_test.php are passed.

        mdk phpunit -r -u lib/tests/session/redis_test.php

        or

        vendor/bin/phpunit lib/tests/session/redis_test.php  

      Redis Cluster // Session

      1. Open config.php and add the below codes:

        define(
          'TEST_SESSION_REDIS_HOSTCLUSTER',
          '172.23.0.11,172.23.0.12,172.23.0.13,172.23.0.14,172.23.0.15,172.23.0.16'
        );
        define(
          'TEST_SESSION_REDIS_ENCRYPTCLUSTER',
          ['verify_peer' => false, 'verify_peer_name' => false],
        );
        define(
          'TEST_SESSION_REDIS_AUTHCLUSTER',
          'foobared'
        );

      2. VERIFY all the tests in lib/tests/session_redis_cluster_test.php are passed.

        mdk phpunit -r -u lib/tests/session_redis_cluster_test.php

        or

        vendor/bin/phpunit lib/tests/session_redis_cluster_test.php  

      Redis standalone // Cache store

      1. Open config.php and add the below codes:

        define(
          'TEST_CACHESTORE_REDIS_TESTSERVERS',
          '127.0.0.1:6380'
        );

      2. VERIFY all the tests in cache/stores/redis/tests/cachestore_redis_test.php are passed.

        mdk phpunit -r -u cache/stores/redis/tests/cachestore_redis_test.php

        or

        vendor/bin/phpunit cache/stores/redis/tests/cachestore_redis_test.php  

      Redis Cluster // Cache store

      1. Open config.php and add the below codes:

        define(
          'TEST_CACHESTORE_REDIS_SERVERSCLUSTER',
          '172.23.0.11,172.23.0.12,172.23.0.13,172.23.0.14,172.23.0.15,172.23.0.16'
        );
        define(
          'TEST_CACHESTORE_REDIS_ENCRYPTCLUSTER',
          true
        );
        define(
          'TEST_CACHESTORE_REDIS_AUTHCLUSTER',
          'foobared'
        );

      2. VERIFY all the tests in cache/stores/redis/tests/cachestore_cluster_redis_test.php are passed.

        mdk phpunit -r -u cache/stores/redis/tests/cachestore_cluster_redis_test.php

        or

        vendor/bin/phpunit cache/stores/redis/tests/cachestore_cluster_redis_test.php  

      Show
      Setup requirements During the unit testing, if enabled, please disable the Xdebug on your PHP CLI config. PHPRedis: https://github.com/phpredis/phpredis The testings use two types of connection, Redis standalone and Redis cluster. Each connection uses a different docker image. Redis standalone , run the below command: docker run --name redis -p 6380 : 6379 -d redis:alpine Redis cluster Clone this repo: https://github.com/meirzamoodle/middleware-tutorials-redis-cluster-tls/tree/main#usage and please follow the instructions on Usage section. Note This bug needs to be tested with 2 versions of PHPRedis: 5.3.7 and 6.0.2 To install PHPRedis with a specific version, do as below: git clone https://github.com/phpredis/phpredis.git cd phpredis git checkout tags/ [Target_Version] -b [Target_Version] phpize ./configure make && make install Add extension=redis.so to your php.ini file Restart PHP and Apache/Nginx service Redis standalone // Session Open config.php and add the below codes:  define(   'TEST_SESSION_REDIS_HOST' ,   '127.0.0.1:6380' ); VERIFY all the tests in lib/tests/session/redis_test.php are passed. mdk phpunit -r -u lib/tests/session/redis_test.php or vendor/bin/phpunit lib/tests/session/redis_test.php Redis Cluster // Session Open config.php and add the below codes: define(   'TEST_SESSION_REDIS_HOSTCLUSTER' ,   '172.23.0.11,172.23.0.12,172.23.0.13,172.23.0.14,172.23.0.15,172.23.0.16' ); define(   'TEST_SESSION_REDIS_ENCRYPTCLUSTER' ,   [ 'verify_peer' => false , 'verify_peer_name' => false ], ); define(   'TEST_SESSION_REDIS_AUTHCLUSTER' ,   'foobared' ); VERIFY all the tests in lib/tests/session_redis_cluster_test.php are passed. mdk phpunit -r -u lib/tests/session_redis_cluster_test.php or vendor/bin/phpunit lib/tests/session_redis_cluster_test.php Redis standalone // Cache store Open config.php and add the below codes: define(   'TEST_CACHESTORE_REDIS_TESTSERVERS' ,   '127.0.0.1:6380' ); VERIFY all the tests in cache/stores/redis/tests/cachestore_redis_test.php are passed. mdk phpunit -r -u cache/stores/redis/tests/cachestore_redis_test.php or vendor/bin/phpunit cache/stores/redis/tests/cachestore_redis_test.php Redis Cluster // Cache store Open config.php and add the below codes: define(   'TEST_CACHESTORE_REDIS_SERVERSCLUSTER' ,   '172.23.0.11,172.23.0.12,172.23.0.13,172.23.0.14,172.23.0.15,172.23.0.16' ); define(   'TEST_CACHESTORE_REDIS_ENCRYPTCLUSTER' ,   true ); define(   'TEST_CACHESTORE_REDIS_AUTHCLUSTER' ,   'foobared' ); VERIFY  all the tests in cache/stores/redis/tests/cachestore_cluster_redis_test.php are passed. mdk phpunit -r -u cache/stores/redis/tests/cachestore_cluster_redis_test.php or vendor/bin/phpunit cache/stores/redis/tests/cachestore_cluster_redis_test.php
    • 2
    • Team Hedgehog 2024 Sprint 3.2, Team Hedgehog 2024 Sprint 3.3

      Error

      Exception - Unknown named parameter $read_timeout
      Debug info:
      Error code: generalexceptionmessage
      Stack trace: * line 292 of /lib/classes/session/redis.php: Error thrown

      • line 149 of /lib/classes/session/manager.php: call to core\session\redis->init()
      • line 136 of /lib/classes/session/manager.php: call to core\session\manager::start_session()
      • line 905 of /lib/setup.php: call to core\session\manager::start()
      • line 51 of /config.php: call to require_once()
      • line 37 of /my/index.php: call to require_once()

      ====================

      I tested with different PHP and PHPRedis versions.

      PHP PHPRedis Result
      8.3 5.3.5 Error
      8.2 6.0.2 Success
      8.1 6.0.2 Success

      FYI, the problem is not only the read_timeout but also with the context parameter.

      I dug into the PHPRedis repository to find the root cause. It turns out that before version 6.0.0, for example, 5.3.5, PHPRedis only exposes some of the params that can be used as named params. Check the code here.

      Since version 6.0.0, PHPRedis has used redis.stub.php to expose parameters on each functions.

            meirza.arson@moodle.com Meirza
            meirza.arson@moodle.com Meirza
            Matt Porritt Matt Porritt
            Huong Nguyen Huong Nguyen
            Safat Shahin Safat Shahin
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours, 47 minutes
                1d 4h 47m

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