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

When the system time is modified forward, celery beat does not automatically clear “last_run_at” and falls into an endless loop。 #5892

Open
18 tasks
daleeg opened this issue Dec 27, 2019 · 4 comments

Comments

@daleeg
Copy link
Contributor

daleeg commented Dec 27, 2019

Checklist

  • I have verified that the issue exists against the master branch of Celery.
  • This has already been asked to the discussion group first.
  • I have read the relevant section in the
    contribution guide
    on reporting bugs.
  • I have checked the issues list
    for similar or identical bug reports.
  • I have checked the pull requests list
    for existing proposed fixes.
  • I have checked the commit log
    to find out if the bug was already fixed in the master branch.
  • I have included all related issues and possible duplicate issues
    in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

  • I have included the output of celery -A proj report in the issue.
    (if you are not able to do this, then at least specify the Celery
    version affected).
  • I have verified that the issue exists against the master branch of Celery.
  • I have included the contents of pip freeze in the issue.
  • I have included all the versions of all the external dependencies required
    to reproduce this bug.

Optional Debugging Information

  • I have tried reproducing the issue on more than one Python version
    and/or implementation.
  • I have tried reproducing the issue on more than one message broker and/or
    result backend.
  • I have tried reproducing the issue on more than one version of the message
    broker and/or result backend.
  • I have tried reproducing the issue on more than one operating system.
  • I have tried reproducing the issue on more than one workers pool.
  • I have tried reproducing the issue with autoscaling, retries,
    ETA/Countdown & rate limits disabled.
  • I have tried reproducing the issue after downgrading
    and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

  • None

Possible Duplicates

  • None

Environment & Settings

Celery version:

celery report Output:


Steps to Reproduce

Required Dependencies

  • Minimal Python Version: N/A or Unknown
  • Minimal Celery Version: N/A or Unknown
  • Minimal Kombu Version: N/A or Unknown
  • Minimal Broker Version: N/A or Unknown
  • Minimal Result Backend Version: N/A or Unknown
  • Minimal OS and/or Kernel Version: N/A or Unknown
  • Minimal Broker Client Version: N/A or Unknown
  • Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:


Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

Actual Behavior

@daleeg
Copy link
Contributor Author

daleeg commented Dec 27, 2019

Solution

from

class ScheduleEntry(object):   
    def is_due(self):
        """See :meth:`~celery.schedule.schedule.is_due`."""
        return self.schedule.is_due(self.last_run_at)

to

class ScheduleEntry(object):   
    def is_due(self):
        """See :meth:`~celery.schedule.schedule.is_due`."""
        current = self.default_now()
        if current < self.last_run_at:
            self.last_run_at = current
        return self.schedule.is_due(self.last_run_at)

@matteius
Copy link
Contributor

@vallee11 Your pip freeze output is empty but this I recall was a bug in an earlier version of Celery 4 that I helped fix. Can you try with the the latest Celery 4.4 and latest Kombu packages?

@daleeg
Copy link
Contributor Author

daleeg commented Dec 31, 2019

The version I used is Celery 4.4, python 3.8. I checked the source code and found no code to handle "self.default_now() < self.last_run_at"

@auvipy
Copy link
Member

auvipy commented May 16, 2020

feel free to contribute as a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants