You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Occasionally receiving the wrong record from Redis #1818
On some occasions at sufficient scale (9-10k requests per second), the wrong record is being retrieved from Redis. This issue first appeared when we updated our phpredis driver from 5.0.2 to 5.1.1 (we've since updated to 5.2.2). We have had no luck reproducing the issue outside of our production environment so we believe it to only happen at a sufficient scale that our non-production environments cannot reproduce.
I'm seeing this behaviour on
OS: CentOS 7
Redis: AWS ElastiCache with Clustered Redis engine 4.0.10
PHP: 7.4
phpredis: 5.2.2
Steps to reproduce, backtrace or example script
We have had no luck as of yet reproducing the issue outside of our production environment.
We had seen the issue once before when upgrading to a 4.x version of the driver and it went away when updated to 5.0.2. I'm trying to track down what specific versions we were using in the first upgrade that went from working to not working.
@yatsukhnenko
Two days ago we moved auth parameter to pconnect (['auth' => $password]) and removed auth command. Because of AUTH bug.
After this release we started to receive complains from our devs about "redis returns not that we set". This issue was confirmed - sometimes GET returns garbage (probably values of other keys). This release was reverted and our SRE investigating it now.
Sorry for delay, currently we can't turn on pooling_enabled because all out team busy moving to redis cluster and did not use persist :) Is pooling_enabled affects connections to cluster too?
We had the same issue with an older version of PHP Redis using FPMs in a production environment. Upgrading to 5.3.2 with redis.pconnect.echo_check_liveness and redis.pconnect.pooling_enabled as their defaults (enabled) seems to have fixed the problem.
We're facing same issue, and it happens when requests to Redis cluster is increasing.
I.e. we've stable situation (by Grafana's charts), but if we've peak - we can receive wrong data from client.
persistent option in RedisCluster constructor is set to true
But if I disable read from slaves in any manner (with RedisCluster::FAILOVER_NONE) problem gones away and never happens.
Problem is that our current setup is limited in budget and we can't allow interaction with masters only, so that we do balancing with read from slaves.
I can't find issue just in code :( If you're too busy to lookup, can you point me how to create local developer enviorionment, please?
So that I will try to debug code step by step, to get idea of it's workflow.
Activity
FryJay commentedon Jul 27, 2020
Other information that might be relevant:
miksir commentedon Aug 21, 2020
Same issue.
Redis 5.3.1 Php 7.2.33, pconnect used
We got issue #1757 and we have added password to options for fix it. Right after that we got same troubles.
yatsukhnenko commentedon Aug 21, 2020
@miksir you can try to set auth parameter in
pconnectand not using separatedauthmethod?miksir commentedon Aug 21, 2020
@yatsukhnenko
Two days ago we moved auth parameter to pconnect (
['auth' => $password]) and removed auth command. Because of AUTH bug.After this release we started to receive complains from our devs about "redis returns not that we set". This issue was confirmed - sometimes GET returns garbage (probably values of other keys). This release was reverted and our SRE investigating it now.
yatsukhnenko commentedon Aug 21, 2020
@miksir Have you disabled
redis.pconnect.echo_check_livenessin your ini settings?miksir commentedon Aug 21, 2020
redis.pconnect.echo_check_liveness enabled
We will try echo_check_liveness, probably it can help to us even with
authcommand because we have reconnection logic in php. Thanksmiksir commentedon Aug 21, 2020
@yatsukhnenko just checked - we don't use
pooling_enabled, soecho_check_livenessshouldn't have an effectyatsukhnenko commentedon Aug 21, 2020
@miksir then you should use
pooling_enabled. It was made to fix issues like yours 😄yatsukhnenko commentedon Aug 28, 2020
@FryJay @miksir did you try to turn on
pooling_enabledandecho_check_livenessINI options?miksir commentedon Sep 18, 2020
Sorry for delay, currently we can't turn on pooling_enabled because all out team busy moving to redis cluster and did not use persist :) Is pooling_enabled affects connections to cluster too?
Novynn commentedon Feb 16, 2021
We had the same issue with an older version of PHP Redis using FPMs in a production environment. Upgrading to 5.3.2 with
redis.pconnect.echo_check_livenessandredis.pconnect.pooling_enabledas their defaults (enabled) seems to have fixed the problem.ebogdanov commentedon Mar 22, 2021
We're facing same issue, and it happens when requests to Redis cluster is increasing.
I.e. we've stable situation (by Grafana's charts), but if we've peak - we can receive wrong data from client.
But if I disable read from slaves in any manner (with RedisCluster::FAILOVER_NONE) problem gones away and never happens.
Problem is that our current setup is limited in budget and we can't allow interaction with masters only, so that we do balancing with read from slaves.
I can't find issue just in code :( If you're too busy to lookup, can you point me how to create local developer enviorionment, please?
So that I will try to debug code step by step, to get idea of it's workflow.
Thanks in advance.
ebogdanov commentedon Apr 1, 2021
Well, I've found the cause of the issue.
It is "redis.clusters.cache_slots" option. If it set to 1, then liveness checks are not performed at all.
@michael-grunder Can you confirm that this is by design, please?
michael-grunder commentedon Oct 31, 2025
Sorry for such a long delay but I'm going through old issues.
No, we should continue to do the liveness check even if caching slots. The slot cache and liveness check are two independent parts of the code.
I just tested this and it works as expected locally.
I'll close the issue since it's now so old but if anyone is still having this problem, feel free to reopen or comment and I will try to help.