Hi guys,
I've been dealing with an issue that is not directly related to this bundle
If you want more details https://github.com/phpredis/phpredis/issues/1726 and https://bugs.php.net/bug.php?id=79501
TL;DR with PHP >= 7.4, tls v1.3 is used by default and seems to result in random frozen connections (Both Predis and PHPRedis sa it's at the php layer)
The quick fix in the meanwhile is to force the connection to use tls 1.2, this is achieved by using the following connection string tlsv1.2://my-redis-server:6379
instead of tls://my-redis-server:6379
After looking at the factories, the change is pretty basic to do
Here: https://github.com/snc/SncRedisBundle/blob/master/src/Factory/PhpredisClientFactory.php#L134
And here: https://github.com/snc/SncRedisBundle/blob/master/src/Factory/PredisParametersFactory.php#L49
But what I am not sure about and why I am creating this issue is to ask your opinion on how to provide this information in the snc bundle config.
So far I've come up with 2 ideas:
- Add an option in the config (Easy and quick to do)
snc_redis:
clients:
default:
type: phpredis
dsn: 'rediss://[email protected]:6379'
options:
tls_version: 1.2
- Add the information in the DSN (Requires extra parsing and "hard" to understand but closer to what is done by the bundle)
snc_redis:
clients:
default:
type: phpredis
dsn: 'redissv1.2://[email protected]:6379'
I'm gonna provide a MR for that, I just wanted your opinion first
On my side I think I'm leaning more towards the 2nd option as it's closer to the reality even if more complex
I've noticed this issue too: https://github.com/snc/SncRedisBundle/issues/604 which is kind of related without being related
The TLS version is not an SSL options but part of the URL itself
enhancement