Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpredis >= 5.3.2 breaks laravel support for non-tls cluster connection #35020

Closed
Huggyduggy opened this issue Oct 29, 2020 · 1 comment
Closed

Comments

@Huggyduggy
Copy link

  • Laravel Version: 8.11.2
  • PHP Version: 7.4
  • Database Driver & Version: 5.3.1 (phpredis)

Description:

phpredis 5.3.2 introduced a new TLS/SSL context and will now try to connect to redis cluster via SSL/TLS when an empty context array is passed. Thus, a non-tls redis cluster connection will return a timeout. phpredis maintainers guess that laravel provides an empty context array when none is provided within the database.php config file.

Our redis configuration:

    'redis' => [
        'client' => 'phpredis',
        'options' => [
            'cluster' => 'redis',
            'persistent' => true,
                  Redis::OPT_SERIALIZER => Redis::SERIALIZER_IGBINARY,
                  Redis::OPT_COMPRESSION => Redis::COMPRESSION_LZ4,
        ],
        'clusters' => [
            'default' => [
                [
                    'scheme' => env('REDIS_SCHEME', 'tcp'), // not set within the environment
                    'host' => env('REDIS_HOST', 'localhost'),
                    'password' => env('REDIS_PASSWORD', null),
                    'port' => env('REDIS_PORT', 6379),
                    'database' => env('REDIS_DATABASE', 0),
                ],
            ],
        ],
    ],

Within PhpRedisConnector lines 159-161 the fallback seems to happen:

        if (version_compare(phpversion('redis'), '5.3.2', '>=')) {
            $parameters[] = Arr::get($options, 'context', []);
        }

More details and hints by the maintainers may be found within the following phpredis issue:

phpredis/phpredis#1870 (comment)

Steps To Reproduce:

Set up a non-tls redis connection (clustered, in our case) using phpredis 5.3.1. Upgrade to phpredis 5.3.2. Boom.

Fix

Omit an empty context array or pass null instead.

@taylorotwell
Copy link
Member

Already fixed on patch release for today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants