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

Cron schedule bug #4173

Closed
adrok opened this issue Apr 15, 2016 · 6 comments
Closed

Cron schedule bug #4173

adrok opened this issue Apr 15, 2016 · 6 comments
Labels
bug report Fixed in 2.1.x The issue has been fixed in 2.1 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@adrok
Copy link

adrok commented Apr 15, 2016

Steps to reproduce

  1. Install Magento from develop branch.
  2. run bin/magento cron:run

Expected result

  1. With default configuration, generated 4 jobs for "newsletter_send_all" (every 5 minutes, ahead 20 minutes)

Actual result

  1. Generated one job

magento2/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php wrong return statement (for cycle)

if ($schedule->trySchedule()) {
                // time matches cron expression
                $schedule->save();
                return; //remove it!
            }

@mazhalai
Copy link
Contributor

@adrok thank you for reporting, we have MAGETWO-51939 to investigate and fix.

@mazhalai mazhalai added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development MX labels Apr 15, 2016
@kanduvisla
Copy link
Contributor

Could this also be related with an issue I am having at the moment? I'm trying to schedule multiple jobs in one group, with the same instance, but different methods:

<job name="sync_inventory_5m" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_5m">
    <schedule>*/5 * * * *</schedule>
</job>
<job name="sync_inventory_10m" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_10m">
    <schedule>*/10 * * * *</schedule>
</job>
<job name="sync_inventory_15m" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_15m">
    <schedule>*/15 * * * *</schedule>
</job>
<job name="sync_inventory_30m" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_30m">
    <schedule>*/30 * * * *</schedule>
</job>
<job name="sync_inventory_1h" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_1h">
    <schedule>0 * * * *</schedule>
</job>
<job name="sync_inventory_2h" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_2h">
    <schedule>0 */2 * * *</schedule>
</job>
<job name="sync_inventory_3h" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_3h">
    <schedule>0 */3 * * *</schedule>
</job>
<job name="sync_inventory_6h" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_6h">
    <schedule>0 */6 * * *</schedule>
</job>
<job name="sync_inventory_12h" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_12h">
    <schedule>0 */12 * * *</schedule>
</job>
<job name="sync_inventory_24h" instance="Vendor\Module\Cron\SynchronizeInventory" method="execute_24h">
    <schedule>0 0 * * *</schedule>
</job>

The result in the database table are crons for 5m, 10m and 15m and sometimes 30m. Could it be that Magento 2 thinks these are duplicate crons and thinks 'hey 5 minutes also fits in 10 and 15, so I don't need te re-schedule it'. Fact is that I do need to run those different methods on different intervals

@kanduvisla
Copy link
Contributor

Perhaps related to this bug: tested in M2.1.1: when I add a cronjob that needs to be executed every 5 minutes, it's executed every 20 minutes or so.

AntonEvers pushed a commit to AntonEvers/magento2 that referenced this issue Mar 21, 2017
Only one schedule entry was generated at schedule generation because of this `return;`.

fixes magento#4173
@adrian-martinez-interactiv4
Copy link
Contributor

Why isn't this fix already applied at 2.1.7 version ? :(

@korostii
Copy link
Contributor

@magento-team, please reopen this until the fix is released in a 2.1.x version.

@magento-engcom-team
Copy link
Contributor

Hi @adrok. Thank you for your report.
The issue has been fixed in #14096 by @simpleadm in 2.1-develop branch
Related commit(s):

The fix will be available with the upcoming 2.1.14 release.

@magento-engcom-team magento-engcom-team added Fixed in 2.1.x The issue has been fixed in 2.1 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Mar 16, 2018
magento-engcom-team pushed a commit to okorshenko/magento2 that referenced this issue May 15, 2019
[performance] MC-4244: Skip URL rewrites multiplication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Fixed in 2.1.x The issue has been fixed in 2.1 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

9 participants