Skip to content

The Redis INFO command called in RedisTrait::doClear can fail: "The command 'INFO' is not allowed in replication mode." #35867

Closed
@msarris

Description

@msarris

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions