magento2-cron-scheduler icon indicating copy to clipboard operation
magento2-cron-scheduler copied to clipboard

Invalid theme key error, possibly caused by LongJobChecker

Open JosephLeedy opened this issue 4 years ago • 3 comments

Title

Preconditions

  1. Magento 2.4.0
  2. PHP 7.4
  3. MySQL 5.7
  4. CronScheduler 1.0.6 with patch from PR #21

Steps to reproduce

  1. Set up a Magento store with multiple themes

Expected result

  1. No error should be logged

Actual result

  1. "Invalid theme key" error is written to exception.log

Additional Information

I created an extension with an around plug-in on the method throwing the error, and received this stack trace:

{
  "trace": [
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 58,
      "function": "create",
      "class": "Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 138,
      "function": "___callParent",
      "class": "Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/app/code/Wagento/ThemeErrorDebug/Plugin/Framework/View/Design/Theme/FlyweightFactoryPlugin.php",
      "line": 22,
      "function": "Magento\\Framework\\Interception\\{closure}",
      "class": "Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 135,
      "function": "aroundCreate",
      "class": "Wagento\\ThemeErrorDebug\\Plugin\\Framework\\View\\Design\\Theme\\FlyweightFactoryPlugin",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 153,
      "function": "Magento\\Framework\\Interception\\{closure}",
      "class": "Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/generated/code/Magento/Framework/View/Design/Theme/FlyweightFactory/Interceptor.php",
      "line": 26,
      "function": "___callPlugins",
      "class": "Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/module-theme/Model/View/Design.php",
      "line": 148,
      "function": "create",
      "class": "Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/module-theme/Model/View/Design.php",
      "line": 212,
      "function": "setDesignTheme",
      "class": "Magento\\Theme\\Model\\View\\Design",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/App/Area.php",
      "line": 261,
      "function": "setDefaultDesignTheme",
      "class": "Magento\\Theme\\Model\\View\\Design",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/App/Area.php",
      "line": 219,
      "function": "_initDesign",
      "class": "Magento\\Framework\\App\\Area",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/App/Area.php",
      "line": 143,
      "function": "_loadPart",
      "class": "Magento\\Framework\\App\\Area",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/View/DesignLoader.php",
      "line": 54,
      "function": "load",
      "class": "Magento\\Framework\\App\\Area",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/App/Action/Plugin/LoadDesignPlugin.php",
      "line": 53,
      "function": "load",
      "class": "Magento\\Framework\\View\\DesignLoader",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 121,
      "function": "beforeExecute",
      "class": "Magento\\Framework\\App\\Action\\Plugin\\LoadDesignPlugin",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 153,
      "function": "Magento\\Framework\\Interception\\{closure}",
      "class": "KiwiCommerce\\CronScheduler\\Controller\\Adminhtml\\Cron\\LongJobChecker\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/generated/code/KiwiCommerce/CronScheduler/Controller/Adminhtml/Cron/LongJobChecker/Interceptor.php",
      "line": 26,
      "function": "___callPlugins",
      "class": "KiwiCommerce\\CronScheduler\\Controller\\Adminhtml\\Cron\\LongJobChecker\\Interceptor",
      "type": "->"
    },
    {
      "function": "execute",
      "class": "KiwiCommerce\\CronScheduler\\Controller\\Adminhtml\\Cron\\LongJobChecker\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/kiwicommerce/module-cron-scheduler/Observer/ProcessCronQueueObserver.php",
      "line": 151,
      "function": "call_user_func_array"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/kiwicommerce/module-cron-scheduler/Observer/ProcessCronQueueObserver.php",
      "line": 603,
      "function": "_runJob",
      "class": "KiwiCommerce\\CronScheduler\\Observer\\ProcessCronQueueObserver",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/kiwicommerce/module-cron-scheduler/Observer/ProcessCronQueueObserver.php",
      "line": 370,
      "function": "processPendingJobs",
      "class": "KiwiCommerce\\CronScheduler\\Observer\\ProcessCronQueueObserver",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/kiwicommerce/module-cron-scheduler/Observer/ProcessCronQueueObserver.php",
      "line": 545,
      "function": "KiwiCommerce\\CronScheduler\\Observer\\{closure}",
      "class": "KiwiCommerce\\CronScheduler\\Observer\\ProcessCronQueueObserver",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/kiwicommerce/module-cron-scheduler/Observer/ProcessCronQueueObserver.php",
      "line": 371,
      "function": "lockGroup",
      "class": "KiwiCommerce\\CronScheduler\\Observer\\ProcessCronQueueObserver",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Event/Invoker/InvokerDefault.php",
      "line": 88,
      "function": "execute",
      "class": "KiwiCommerce\\CronScheduler\\Observer\\ProcessCronQueueObserver",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Event/Invoker/InvokerDefault.php",
      "line": 74,
      "function": "_callObserverMethod",
      "class": "Magento\\Framework\\Event\\Invoker\\InvokerDefault",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/module-staging/Model/Event/Manager.php",
      "line": 97,
      "function": "dispatch",
      "class": "Magento\\Framework\\Event\\Invoker\\InvokerDefault",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/generated/code/Magento/Staging/Model/Event/Manager/Proxy.php",
      "line": 95,
      "function": "dispatch",
      "class": "Magento\\Staging\\Model\\Event\\Manager",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/App/Cron.php",
      "line": 86,
      "function": "dispatch",
      "class": "Magento\\Staging\\Model\\Event\\Manager\\Proxy",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/module-cron/Console/Command/CronCommand.php",
      "line": 117,
      "function": "launch",
      "class": "Magento\\Framework\\App\\Cron",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/symfony/console/Command/Command.php",
      "line": 255,
      "function": "execute",
      "class": "Magento\\Cron\\Console\\Command\\CronCommand",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 58,
      "function": "run",
      "class": "Symfony\\Component\\Console\\Command\\Command",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 138,
      "function": "___callParent",
      "class": "Magento\\Cron\\Console\\Command\\CronCommand\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Interception/Interceptor.php",
      "line": 153,
      "function": "Magento\\Framework\\Interception\\{closure}",
      "class": "Magento\\Cron\\Console\\Command\\CronCommand\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/generated/code/Magento/Cron/Console/Command/CronCommand/Interceptor.php",
      "line": 26,
      "function": "___callPlugins",
      "class": "Magento\\Cron\\Console\\Command\\CronCommand\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/symfony/console/Application.php",
      "line": 1000,
      "function": "run",
      "class": "Magento\\Cron\\Console\\Command\\CronCommand\\Interceptor",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/symfony/console/Application.php",
      "line": 271,
      "function": "doRunCommand",
      "class": "Symfony\\Component\\Console\\Application",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/magento/framework/Console/Cli.php",
      "line": 115,
      "function": "doRun",
      "class": "Symfony\\Component\\Console\\Application",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/vendor/symfony/console/Application.php",
      "line": 147,
      "function": "doRun",
      "class": "Magento\\Framework\\Console\\Cli",
      "type": "->"
    },
    {
      "file": "/var/www/releases/20200814220155/bin/magento",
      "line": 23,
      "function": "run",
      "class": "Symfony\\Component\\Console\\Application",
      "type": "->"
    }
  ]
}

it seems that when LongJobChecker runs, an empty theme key gets passed somewhere, causing this error to be thrown. It could have something to do with the fact that it extends from \Magento\Backend\App\Action.

JosephLeedy avatar Aug 28 '20 20:08 JosephLeedy

Hi, I get the same error

"Incorrect theme identification key" by using M2 2.4 with Cron Scheduler (ver.1.0.7)

MartinKuhl avatar Oct 05 '20 15:10 MartinKuhl

Same error as well on Magento 2.4.1

logged in cron.log is:

[2020-10-29 18:15:05] main.INFO: Cron Job kiwicommerce_cronscheduler_jobchecker is run [] []
[2020-10-29 18:15:05] main.ERROR: Cron Job kiwicommerce_cronscheduler_jobchecker has an error: Incorrect theme identification key. Statistics: {"sum":0,"count":1,"realmem":0,"emalloc":0,"realmem_start":78643200,"emalloc_start":76798296} [] []
[2020-10-29 18:15:05] main.CRITICAL: Incorrect theme identification key {"exception":"[object] (InvalidArgumentException(code: 0): Incorrect theme identification key at /home/user/public_html/vendor/magento/framework/View/Design/Theme/FlyweightFactory.php:60)"} []

wssweb avatar Oct 29 '20 18:10 wssweb

It also happens with the email job as well, even when the email reporting is disabled (again magento 2.4.1):

[2020-11-02 20:14:04] main.INFO: Cron Job kiwicommerce_send_email is run [] []
[2020-11-02 20:14:04] main.ERROR: Cron Job kiwicommerce_send_email has an error: Incorrect theme identification key. Statistics: {"sum":0,"count":1,"realmem":0,"emalloc":0,"realmem_start":71827456,"emalloc_start":70926088} [] []
[2020-11-02 20:14:04] main.CRITICAL: Incorrect theme identification key {"exception":"[object] (InvalidArgumentException(code: 0): Incorrect theme identification key at /home/user/public_html/vendor/magento/framework/View/Design/Theme/FlyweightFactory.php:60)"} []

All other jobs have been running fine

wssweb avatar Nov 02 '20 20:11 wssweb