Skip to content

Cron starts when it's already running #10650

Closed
@kanduvisla

Description

@kanduvisla

I noticed that when I start a cron that's already running it will run again. For example: I have a task that takes 15 minutes, but the cron executes it's every 5 minutes. In the database the cron gets the status running and the other scheduled jobs have pending. But after 5 minutes, the other job (with the same code) also starts to run. So now I have the same job running twice!

Preconditions

  1. Magento 2.1.7

Steps to reproduce

  1. Create a cron that takes a while (for example, sleep 15 minutes)
  2. Schedule it to run every 5 minutes

Expected result

The other jobs should wait for the first job to complete, even though they are scheduled to run every 5 minutes.

Actual result

The new job starts, ignoring the fact that it's already running...

I'm not sure if this is intended behavior or a bug. Am I expected to create my own lock / flag for this?

Metadata

Metadata

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions