-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
The Redis INFO command called in RedisTrait::doClear can fail: "The command 'INFO' is not allowed in replication mode." #35867
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
Comments
Yea, for me it happened like this
Very interesting to have |
Predis is not maintained anymore, so I forked the redis client. BUT that needs a little bit attention to the configuration of redis. Best all versions of your redis instances are equal! |
Hey, thanks for your report! |
PR welcome! |
No still using my fork currently. |
@DemigodCode if you think we should patch Symfony, can you please send us a PR? |
@nicolas-grekas don't think my changes will work for everyone. |
Maybe removing that line would work? |
I'll give it a try next week and will let you know. |
Long long time ago... Just remembered... They didn't want to "activate" the info command in replication mode.
|
Give that both calls happen on a path when a write is going to happen, going to the master is not a problem to me. |
Yes, next week. Have to check if phpredis has the same interface. |
… Environments (DemigodCode) This PR was merged into the 4.4 branch. Discussion ---------- [Cache] Add server-commands support for Predis Replication Environments | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #35867 | License | MIT | Doc PR | This fix is for predis MasterSlaveConnections which don't allow to run server commands. Due to that it's not possible to e.g. clear a cache with cache:pool:clear. PhpRedis and Predis do not have the same interface, so have to check which implementation is used. Furthermore, the getClientFor('master') works only for replicated redis instances. Commits ------- 2ae5c33 [Cache] Add server-commands support for Predis Replication Environments
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 RedisINFO
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:
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 text was updated successfully, but these errors were encountered: