Description
Symfony version(s) affected: 4.4, 5.0
Description
In \Symfony\Component\Cache\Traits\RedisTrait::doClear
there's a method call $host->info('Server')
which executes the Redis INFO
command.
Currently there's no exception handling on this call, but I think there should as this command can throw an exception, at least the following:
The command 'INFO' is not allowed in replication mode.
How to reproduce
I'm not sure how to easily reproduce this issue. I see the logs in production, but only occasionally, so it only occurs when the Redis instance(s) are in replication mode, which is not all the time, since the error doesn't usually happen.
Possible Solution
Add a try catch
statement to defend against the possible failing of this call and to not interfere with clearing the cache.
Additional context
The full log message I currenly get is the following (I use the Predis client):
The command 'INFO' is not allowed in replication mode. {"exception":"[object] (Predis\NotSupportedException(code: 0): The command 'INFO' is not allowed in replication mode.