Closed mingmingxianseng closed 5 years ago
+1
This issue started happening to me when I switched my redis maxmemory-policy
to allkeys-lru
https://aws.amazon.com/premiumsupport/knowledge-center/oom-command-not-allowed-redis/
Also on newer releases?
On Wed, 15 Aug 2018, 06:41 javabudd, notifications@github.com wrote:
+1
This issue started happening to me when I switched my redis maxmemory-policy to allkeys-lru
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/doctrine/doctrine2/issues/7266#issuecomment-413092535, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakJ8-mq2jbPd2iWhz8UMRSITWb-dNks5uQ6aSgaJpZM4Us3BS .
I'm currently on 2.6.2
Fixing the conditional is incorrect there: would need to change the fetch operation so that multiple misses don't become false[]
Can this be reproduced with a failing test case?
I'll try and reproduce
## in Doctrine\Common\Cache\RedisCache.php +72
protected function doFetchMultiple(array $keys)
{
$fetchedItems = array_combine($keys, $this->redis->mget($keys));
// Redis mget returns false for keys that do not exist. So we need to filter those out unless it's the real data.
$foundItems = [];
foreach ($fetchedItems as $key => $value) {
# change this line to if (false !== $value )
if (false !== $value || $this->redis->exists($key)) {
$foundItems[$key] = $value;
}
}
return $foundItems;
}
I create a new class extends RedisCache and change false !== $value || $this->redis->exists($key)
to false !== $value
.
The problem was solved temporarily.
Please don't suggest ugly workarounds when a solution here is possible:
On Thu, 16 Aug 2018, 05:35 mingmingxianseng, notifications@github.com wrote:
in Doctrine\Common\Cache\RedisCache.php +72
protected function doFetchMultiple(array $keys) { $fetchedItems = array_combine($keys, $this->redis->mget($keys)); // Redis mget returns false for keys that do not exist. So we need to filter those out unless it's the real data. $foundItems = []; foreach ($fetchedItems as $key => $value) { # change this line to if (false !== $value ) if (false !== $value || $this->redis->exists($key)) { $foundItems[$key] = $value; } } return $foundItems; }
I create a new class extends RedisCache and change false !== $value || $this->redis->exists($key) to false !== $value.
The problem was solved temporarily.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/doctrine/doctrine2/issues/7266#issuecomment-413414466, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakAam814lzIA1o08lnhQf9ZjzzR30ks5uROhpgaJpZM4Us3BS .
I don't think it's a code problem. maybe I didn't find it. maybe other code changed the cache. maybe my other code effected it. maybe redis's rules...eg.. It only happens in production environment in my project, so it is really hard to reproduce.
but the fact is that a cache is not a legitimate entity identifier, it is a false, shouldn't we judge whether this cache is legal ? i think make this cache miss is always better than throw a fatal error. so i took the interim plan as I mentioned in my last comment.
maybe it is a ugly workarounds, but it is really effective, isn't it .
And in our project, there will be no false in cache.
Forgive me for my poor English and my humble opinion. 😝
A cache miss can be emulated, and that's what should happen in the test scenario
On Fri, 17 Aug 2018, 09:22 mingmingxianseng, notifications@github.com wrote:
I don't think it's a code problem. maybe I didn't find it. maybe other code changed the cache. maybe my other code effected it. maybe redis's rules...eg.. It only happens in production environment in my project, so it is really hard to reproduce.
but the fact is that a cache is not a legitimate entity identifier, it is a false, shouldn't we judge whether this cache is legal ? i think make this cache miss is always better than throw a fatal error. so i took the interim plan as I mentioned in my last comment.
maybe it is a ugly workarounds, but it is really effective, isn't it .
And in our project, there will be no false in cache.
Forgive me for my poor English and my humble opinion. 😝
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/doctrine/doctrine2/issues/7266#issuecomment-413780620, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakBaqz_WAJUJrzY4BSlwzQCOKl5N3ks5uRm8fgaJpZM4Us3BS .
normal cache's value's type is object . but in this case , the cache's value is "false".
so it throw exception Call to a member function resolveAssociationEntries() on boolean
.
Yes: let's put it in a test, reproduce the cache behavior there and figure out how to fix it afterwards (and only afterwards! Test comes first.) :-)
Upgrading the Redis engine from 4 -> 5 seems to have alleviated the issue for me.
Closing here due to missing test scenario.
Same issue exists in v2.6.3
.
The following mistakes occur occasionally,and I can't find the solution
I think the parameter $entityEntry sometimes will be false , then occur the mistakes.
change
if ($entityEntry === null)
toif ($entityEntry === null || $entityEntry === false )
. Is this a good solution ?I need your help. Thank you very much.