Skip to content
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

[InvalidArgumentException] - Cache frontend 'default' is not recognized. #22410

Closed
rafaalvescit opened this issue Apr 18, 2019 · 7 comments
Closed
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@rafaalvescit
Copy link

rafaalvescit commented Apr 18, 2019

Preconditions

  1. Magento 2.2.7
  2. PHP 7.1

Steps to reproduce

1.php bin/magento setup:upgrade

Expected result

  1. Compilation complete

Actual result

print

I did a module to send the logs and exceptions to Microsoft Application Insights. So in this module, I did a plugin to watch the Psr\Log\LoggerInterface.

<type name="Psr\Log\LoggerInterface">
<plugin name="handle_log" type="ApplicationInsights\Plugin\Log"/>
</type>

Log

InvalidArgumentException: Cache frontend 'default' is not recognized. in /var/www/html/vendor/magento/framework/App/Cache/Frontend/Pool.php:150 Stack trace: #0 /var/www/html/vendor/magento/framework/App/Cache/Type/FrontendPool.php(86): Magento\Framework\App\Cache\Frontend\Pool->get('default') #1 /var/www/html/vendor/magento/framework/App/Cache/Type/Config.php(49): Magento\Framework\App\Cache\Type\FrontendPool->get('config') #2 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(65): Magento\Framework\App\Cache\Type\Config->_getFrontend() #3 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(288): Magento\Framework\Cache\Frontend\Decorator\Bare->load('global|primary|...') #4 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(266): Magento\Framework\Interception\PluginList\PluginList->_loadScopedData() #5 /var/www/html/generated/code/Magento/Framework/Logger/Monolog/Interceptor.php(87): Magento\Framework\Interception\PluginList\PluginList->getNext('Magento\Framewo...', 'setHandlers') #6 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(150): Magento\Framework\Logger\Monolog\Interceptor->setHandlers(Array) #7 /var/www/html/vendor/magento/framework/Logger/Monolog.php(23): Monolog\Logger->__construct('report', Array, Array) #8 /var/www/html/generated/code/Magento/Framework/Logger/Monolog/Interceptor.php(14): Magento\Framework\Logger\Monolog->__construct('report', Array, Array) #9 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Logger\Monolog\Interceptor->__construct('report', Array, Array) #10 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Framewo...', Array) #11 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #12 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') #13 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Psr\Log\LoggerI...', NULL, 'logger', 'Magento\Framewo...') #14 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\Framewo...', Array, Array) #15 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...', Array, Array) #16 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #17 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') #18 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Framewo...', NULL, 'logger', 'Magento\Framewo...') #19 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\Framewo...', Array, Array) #20 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...', Array, Array) #21 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...', Array) #22 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Factory.php(197): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewo...', Array) #23 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Factory.php(161): Magento\Framework\App\Cache\Frontend\Factory->_applyDecorators(Object(Magento\Framework\Cache\Frontend\Decorator\TagScope)) #24 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Pool.php(67): Magento\Framework\App\Cache\Frontend\Factory->create(Array) #25 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Pool.php(146): Magento\Framework\App\Cache\Frontend\Pool->_initialize() #26 /var/www/html/vendor/magento/framework/App/Cache/Type/FrontendPool.php(86): Magento\Framework\App\Cache\Frontend\Pool->get('default') #27 /var/www/html/vendor/magento/framework/App/Cache/Type/Config.php(49): Magento\Framework\App\Cache\Type\FrontendPool->get('config') #28 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(65): Magento\Framework\App\Cache\Type\Config->_getFrontend() #29 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(288): Magento\Framework\Cache\Frontend\Decorator\Bare->load('global|primary|...') #30 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(266): Magento\Framework\Interception\PluginList\PluginList->_loadScopedData() #31 /var/www/html/generated/code/Magento/Framework/Logger/Monolog/Interceptor.php(87): Magento\Framework\Interception\PluginList\PluginList->getNext('Magento\Framewo...', 'setHandlers') #32 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(150): Magento\Framework\Logger\Monolog\Interceptor->setHandlers(Array) #33 /var/www/html/vendor/magento/framework/Logger/Monolog.php(23): Monolog\Logger->__construct('report', Array, Array) #34 /var/www/html/generated/code/Magento/Framework/Logger/Monolog/Interceptor.php(14): Magento\Framework\Logger\Monolog->__construct('report', Array, Array) #35 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Logger\Monolog\Interceptor->__construct('report', Array, Array) #36 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Framewo...', Array) #37 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #38 /var/www/html/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php(80): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') #39 /var/www/html/generated/code/Magento/Framework/Stdlib/Cookie/PhpCookieManager/Interceptor.php(14): Magento\Framework\Stdlib\Cookie\PhpCookieManager->__construct(Object(Magento\Framework\Stdlib\Cookie\CookieScope), Object(Magento\Framework\Stdlib\Cookie\PhpCookieReader), NULL, NULL) #40 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Stdlib\Cookie\PhpCookieManager\Interceptor->__construct(Object(Magento\Framework\Stdlib\Cookie\CookieScope), Object(Magento\Framework\Stdlib\Cookie\PhpCookieReader), NULL, NULL) #41 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Framewo...', Array) #42 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #43 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') #44 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Framewo...', NULL, 'cookieManager', 'Magento\Framewo...') #45 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\Framewo...', Array, Array) #46 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...', Array, Array) #47 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #48 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') #49 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Framewo...', NULL, 'response', 'Magento\Framewo...') #50 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\Framewo...', Array, Array) #51 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...', Array, Array) #52 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...', Array) #53 /var/www/html/vendor/magento/framework/App/Bootstrap.php(233): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewo...', Array) #54 /var/www/html/index.php(38): Magento\Framework\App\Bootstrap->createApplication('Magento\Framewo...') #55 {main}

@m2-assistant
Copy link

m2-assistant bot commented Apr 18, 2019

Hi @rafaalvescit. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@rafaalvescit do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Apr 18, 2019
@magento-engcom-team
Copy link
Contributor

Hi @rafaalvescit. Thank you for your request. I'm working on Magento 2.3-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @rafaalvescit, here is your Magento instance.
Admin access: https://i-22410-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@rafaalvescit
Copy link
Author

@magento-engcom-team the project that I working is runing in 2.2.7 version. I can't update this version at the moment.

@rafaalvescit rafaalvescit reopened this Apr 18, 2019
@ghost ghost self-assigned this Apr 19, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 19, 2019

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@ghost
Copy link

ghost commented Apr 19, 2019

Hi @rafaalvescit thank you for you report, i'm not able to reproduce following steps you described, seems like this related to your custom modules.

@ghost ghost closed this as completed Apr 19, 2019
@NicholasRoge
Copy link

NicholasRoge commented Nov 24, 2024

To anyone else who runs into this issue, as @rafaalvescit and I have, the issue is occurring because Magento adds a Logger decorator proxy around has a decorator facade on top of the cache frontend model (Magento\Framework\Cache\Frontend\Decorator\Logger, which is applied by Magento\Framework\App\Cache\Frontend\Factory). The logger decorator class uses the Psr\Logger\LoggerInterface as a dependency (via its dependency on Magento\Framework\Cache\InvalidateLogger, so causing an interceptor to be generated for this class by adding a plugin to Psr\Log\LoggerInterface (or any of the classes that the interface preference type extends) will cause the cache frontend to be invoked again to load the list of plugins when any of its methods are executed. This causes the observed exception because of the call to setHandlers in the constructor of the default logger implementation which uses Monolog\Logger as its base since it invokes the cache frontend pool during its initialization and it assumes it has already been initialized and causes it to believe the "default" cache frontend does not exist.

The simplest solution is to make the $logger argument to Magento\Framework\Cache\Frontend\Decorator\Logger a proxy class, delaying Monolog\Logger's construction until after Magento\Framework\App\Cache\Frontend\Pool has been initialized via di.xml configuration:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\Cache\Frontend\Decorator\Logger">
        <arguments>
            <argument name="logger" xsi:type="object">Magento\Framework\Cache\InvalidateLogger\Proxy</argument>
        </arguments>
    </type>
</config>

at which point you are free to add as many plugins as you would like.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

3 participants