-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Redis preloading fails when exec() returns false #37509
Comments
Hi @LeanderFS. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
@magento I am working on this |
…ay_combine receiving false as second argument
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hello @LeanderFS, Thanks for the reporting and collaboration! Just to confirm, you are mentioning
Are you talking about this repo https://github.com/phpredis/phpredis? If yes, then we have gone through with the documentation of phpredis for the I have taken this screenshot from the below file: Thanks |
I can confirm I was talking about the phpredis/phpredis repository. I should've mentioned that in the initial message. The documentation you've linked is exactly what I mean. The PR linked to this issue fixes the scenario where exec() would return false. |
Thanks @LeanderFS for the response. We are confirming this issue by looking into the phpredis documentation. Thanks |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-8809 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue. |
Preconditions and environment
Steps to reproduce
backend
option toMagento\\Framework\\Cache\\Backend\\Redis
id_prefix
andpreload_keys
bin/magento cache:clean
This might not reproduce the issue in a lot of the cases because in normal scenarios there would be no issues. This issue arises as an edge-case when
\Magento\Framework\Cache\Backend\Redis::load
is being called.$this->preloadedData = array_filter(array_combine($this->preloadKeys, $redis->exec()));
expects the second parameter ofarray_combine
to be an array, but$redis->exec()
can returnfalse
in some cases. Leading to an unexpected exception and inability to runcache:clean
or similar commands that preload keys in Redis.Expected result
I expect the cache:clean command to finish without an error.
Actual result
The following exception is thrown:
array_combine(): Argument #2 ($values) must be of type array, bool given
Additional information
The issue is not immediately apparent, but makes more sense when you look into what the
\Cm_Cache_Backend_Redis
class is doing, which is the class the Magento Redis adapter extends from. TheCm_Cache_Backend_Redis
class pipes the requested method through toCredis_Client
, which in turn pipes the request to phpredis. The method signature forexec()
inCredis_Client
tells us that the return value will always be of the typearray
, but when checking the implementation in phpredis,exec()
can return false. Causing the preloading in Magento to fail.Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: