Magento2: Cron Stopped Working after upgrading to 2.2.5

Created on 13 Jul 2018  Â·  25Comments  Â·  Source: magento/magento2

Preconditions

  1. Magento version 2.2.5
  2. PHP 7.0.3

Steps to reproduce

  1. After upgrading from 2.2.2 to 2.2.5 Cron Job Stopped working
  2. Running Command via SSH - /usr/local/bin/php /home/.../public_html/bin/magento cron:run nothing happens - please see attached image
    cron nothing happens
  1. Accessing from Admin Panel - No Heartbeat found - clicking on the button Run Cron gives an error HTTP Error 500 - please see attached
    cron nothing happens 2

Expected result

  1. [Screenshots, logs or description]

Actual result

  1. [Screenshots, logs or description]
Format is valid non-issue

Most helpful comment

Solved #

Apparently, this is caused by the app/etc/di.xml not being upgraded properly. I recently had this issues investigated by opening a ticket https://support.magento.com/hc/en-us/requests/96612 and the solution was a proper di.xml with the missing section to handle the LockManager.
Please see the attached file for a version that fixes this issue.
[mferguson@aws-sparta-web2 dev]$ diff m225/app/etc/di.xml 96612/app/etc/di.xml
40d39
<
236,240d234
<
<
< Magento\Framework\Session\Config\ConfigInterface\Proxy
<

<

1351,1355d1344
<
<
<
<
< Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT

di.xml.zip

Thank you Matthew Ferguson for your investigation and help diagnosing this issue!

After new app/etc/di.xml
$ php bin/magento cron:run
Ran jobs by schedule.

All 25 comments

Hi @VyacheslavCh. 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 {$VERSION} instance

where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.

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

  • [ ] yes
  • [ ] no

@magento-engcom-team give me 2.2.5 instance

Hi @VyacheslavCh. Thank you for your request. I'm working on Magento 2.2.5 instance for you

Hi @VyacheslavCh, here is your Magento instance.
Admin access: https://i-16793-2-2-5.engcom.dev.magento.com/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

Can't reproduce the issue on vanilla Magento as it doesn't have the Cron job
On Friday, July 13, 2018, 2:53:50 PM EDT, Magento Community Engineering notifications@github.com wrote:

Hi @VyacheslavCh, here is your Magento instance.
Admin access: https://i-16793-2-2-5.engcom.dev.magento.com/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

If it's 500 error, could you @VyacheslavCh provide the error.log contents?

hi @lbajsarowicz no error.log is being created in var directory if trying to run from Admin Panel

Thank you

@lbajsarowicz Attached also the jobs that I have configured - all produce 0 bytes files
capture3

@VyacheslavCh I think it's worth noting that php v7.0.3 isn't supported with version 2.2.x. I have a clean instance of Magento v2.2.5 running with php v7.0.30 and it seems to be operating as expected. Pending jobs are being made, and cron jobs are being run.

But, I think it'd be helpful if you could provide the _apache_ error logs, not just the Magento logs.

Lastly, when you say "Can't reproduce the issue on vanilla Magento as it doesn't have the Cron job," which cron job are you referring to?

@VyacheslavCh, please refer to the Community Forums or the Magento Stack Exchange site for advice or general discussion about this issue. The GitHub issue tracker is intended for Magento Core technical issues only.

Preconditions

  1. Magento version 2.2.5
  2. php 7.1 OR 7.0

Steps to reproduce
Upgraded to Magento 2.2.5 from 2.2.4

Run cron via cli:-

$php -v
PHP 7.0.31-1+ubuntu16.04.1+deb.sury.org+1 (cli)

$php -d memory_limit=-1 public/bin/magento cron:run
OR
$/usr/bin/php7.1 -d memory_limit=-1 public/bin/magento cron:run

Fails to run cron, no jobs executed, no entries created in cron_schedule

Expected result
Cron to run

Actual result
Error Returned:-

PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Lock\LockManagerInterface in public/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:111

Stack trace:

0 public/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Framewo...', Array)

1 public/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\Framewo...')

2 public/vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get('Magento\Framewo...')

3 public/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento in public/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 111

We have investigated running cron with different version of PHP 7. Disabled all third party extensions. Deleted vendor directory, cleared composer cache, redeployed Magento.

As can be seen this relates to the "LockManagerInterface" which was introduced in Magento 2.2.5

Issue also reported via here: https://magento.stackexchange.com/questions/236586/magento-2-2-5-error-on-cronrun-after-every-production-deployment

@Flipmediaco, thank you. We are reopening issue.

@Flipmediaco, we were not able to reproduce this issue by following the steps you provided. Seems like your problem is caused by some custom modules.

On further review I believe you are correct ;-) Potentially Wyomind Cron Scheduler

We have Wyomind Cron Scheduler installed on the instance suffering this issue.

The instance of this error reported on Stack Exchange as confirmed they have Wyomind Cron Scheduler installed. (https://magento.stackexchange.com/questions/236586/magento-2-2-5-error-on-cronrun-after-every-production-deployment)

The issue reported by @VyacheslavCh references a 500 page from within the admin area for viewing and running the cron, no such interface exists as part of the Magento core. The page described by @VyacheslavCh I suspect is the interface provided by the Wyomind Cron Scheduler.

We had disabled all third party extension and run tests specifically Wyomind Cron Scheduler but the error persisted. This lead me to think the error was the core.

I am going to completely remove the Wyomind Cron Scheduler. from our stack and run further tests and report my findings.

With all Wyomind modules removed and all 3rd party modules disabled the issue still persists. I have ruled out the Wyomind not honouring being disabled by completely removing. All other extension have been set to disabled. I rolled back to 2.2.4 and cron works with and without Wyomind Cron Scheduler installed.

If I request test instance can I run the cron via cli?

I am happy to explore configuration to see if I can recreate the issue.

I too am having this cron issue with 2.2.5 -> upgraded from 2.2.3 I believe.

I tracked it down to the failure point (as it was failing silently) and I believe it's Magento\Framework\ObjectManager\Factory\Dynamic\Developer line 47 $type = $this->config->getInstanceType($requestedType);

The $requestedType is set as "Magento\Cron\Observer\ProcessCronQueueObserver" but the $type (instanceType) is set to a non-existent class: Magento\Cron\Observer\ProcessCronQueueObserver\Interceptor.

It's at this point, the cron:run command dies silently.

@pixelated-au > It's at this point, the cron:run command dies silently.

Can you advise what version of php you are running... Please attempt to execute the cron via the Command Line, as follows... and report any error returned.

php -v
// Should return version of PHP
php -d memory_limit=-1 ./bin/magento cron:run
// Should return "Ran jobs by schedule" if worked correctly

@Flipmediaco can you provide Steps to Reproduce this issue on a clean Magento 2 installation?

@Flipmediaco
1) I'm running PHP 7.1.21
2) No output returned from your command. Again, (unlike your scenario) it failed silently.

FWIW, I've already performed running the cron with all available memory (16GB system memory)

Can confirm the same issue.

  • Magento Commerce 2.2.5, Enterprise Edition
  • Tried with PHP 7.0.30 NTS / 7.1.13 ZTS
  • Partially R/O filesystem
  • Split database with Galera backend, MariaDB 10.0.34
  • With or without any cronjobs specified

Error (note the Dynamic/Developer.php:50 here vs the AbstractFactory.php:111 above):
```$ bin/magento cron:run
PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Lock\LockManagerInterface in vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50
Stack trace:

0 vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...')

1 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...')

2 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Framewo...', NULL, 'lockManager', 'Magento\Cron\Ob...')

3 vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\Cron\Ob...', Array, Array)

4 vendor/magento/framework/ObjectManager/Factory/Dynam in vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

```

Also confirmed.
Magento Cloud 2.2.5

$ php bin/magento --version
Magento CLI version 2.2.5

$ php -v
PHP 7.1.21 (cli) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.21, Copyright (c) 1999-2018, by Zend Technologies
with blackfire v1.22.0~linux-x64-zts71, https://blackfire.io, by Blackfire

Solved #

Apparently, this is caused by the app/etc/di.xml not being upgraded properly. I recently had this issues investigated by opening a ticket https://support.magento.com/hc/en-us/requests/96612 and the solution was a proper di.xml with the missing section to handle the LockManager.
Please see the attached file for a version that fixes this issue.
[mferguson@aws-sparta-web2 dev]$ diff m225/app/etc/di.xml 96612/app/etc/di.xml
40d39
<
236,240d234
<
<
< Magento\Framework\Session\Config\ConfigInterface\Proxy
<

<

1351,1355d1344
<
<
<
<
< Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT

di.xml.zip

Thank you Matthew Ferguson for your investigation and help diagnosing this issue!

After new app/etc/di.xml
$ php bin/magento cron:run
Ran jobs by schedule.

I can confirm that once the di.xml was updated as per @ralbin supplied zip and cache cleared, compiled etc, normal cron operation was returned :-)

I have since established the actual issue [in my case] was introduced by our deploy script excluding transferring the di.xml to production. I have since removed this exclusion, re-deployed and the cron has been restored to normal operation.

This also explains why the clean install I built of 2.1.3 and then upgraded to 2.2.5 did not exhibit the problem - because it was using a correctly upgraded and not stale di.xml

Thanks again @ralbin

Yep @ralbin, that's the issue. Sorted! Thank you :)

Closing as solved.

Was this page helpful?
0 / 5 - 0 ratings