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
Our application at some moment was connected to the Redis replica server (accidentally) for the cache.
When we are tried to delete the cache key - Redis throws an exception RedisException - READONLY You can't write against a read-only replica. (which is pretty OK - symfony/cache should catch this error and suppress).
But application written many PHP warnings to the logs - PHP message: PHP Warning: Undefined property: Symfony\Component\Cache\Adapter\RedisTagAwareAdapter::$namespace in /.../vendor/symfony/cache/Adapter/RedisTagAwareAdapter.php on line 168
How to reproduce
Connect to Redis replica server
Use \Symfony\Component\Cache\Adapter\RedisTagAwareAdapter::deleteItems()
Possible Solution
Sorry, symfony/cache is pretty complex to me (heavy usage of traits, multi-level class hierarchy, universal redis adapters for all known drivers), so I can't suggest a fix (or at least an accurate test case).
Need to try to avoid using private trait property \Symfony\Component\Cache\Traits\AbstractAdapterTrait::$namespace from \Symfony\Component\Cache\Adapter\RedisTagAwareAdapter, or find a way to make this property accessible in this context.
Additional Context
PhpStorm mentions issue about inappropriate using trait private property in 2 places (linked from 4.4 branch):
This PR was merged into the 4.4 branch.
Discussion
----------
[Cache] fix error handling when using Redis
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#45325
| License | MIT
| Doc PR | -
Spotted while working on #45313
I won't be able to add tests here, the situations are too edgy.
Commits
-------
3c59e0f [Cache] fix error handling
Symfony version(s) affected
5.4 (probably 4.4 also)
Description
Our application at some moment was connected to the Redis replica server (accidentally) for the cache.
When we are tried to delete the cache key - Redis throws an exception
RedisException
-READONLY You can't write against a read-only replica.
(which is pretty OK -symfony/cache
should catch this error and suppress).But application written many PHP warnings to the logs -
PHP message: PHP Warning: Undefined property: Symfony\Component\Cache\Adapter\RedisTagAwareAdapter::$namespace in /.../vendor/symfony/cache/Adapter/RedisTagAwareAdapter.php on line 168
How to reproduce
\Symfony\Component\Cache\Adapter\RedisTagAwareAdapter::deleteItems()
Possible Solution
Sorry,
symfony/cache
is pretty complex to me (heavy usage of traits, multi-level class hierarchy, universal redis adapters for all known drivers), so I can't suggest a fix (or at least an accurate test case).Need to try to avoid using private trait property
\Symfony\Component\Cache\Traits\AbstractAdapterTrait::$namespace
from\Symfony\Component\Cache\Adapter\RedisTagAwareAdapter
, or find a way to make this property accessible in this context.Additional Context
PhpStorm mentions issue about inappropriate using trait private property in 2 places (linked from 4.4 branch):
doDeleteYieldTags
https://github.com/symfony/cache/blob/16d89b6ad0d2f79c897a66dc82d986996285108c/Adapter/RedisTagAwareAdapter.php#L164doInvalidate
https://github.com/symfony/cache/blob/16d89b6ad0d2f79c897a66dc82d986996285108c/Adapter/RedisTagAwareAdapter.php#L258The text was updated successfully, but these errors were encountered: