Skip to content

Celery beat stops sending tasks on DST changes #6438

@PierreF

Description

@PierreF

On the DST end that happened this weekend for Europe (the 2020-10-29, for CET/CEST or Europe/Paris), celery beat stopped sending tasks that should be running every minutes.

Note: AFAIK, Europe may stop DST change by 2021. so this bug may become irrelevant for Europe/CET/CEST. But other country may still encounter it.

On 26 March 2019, the European Parliament [...] [supports] a stop to the seasonal clock changes by 2021.
-- https://ec.europa.eu/transport/themes/summertime_en

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

This is not the first time DST change cause some issue. Example:

Possible Duplicates

  • None

Environment & Settings

Celery version: 5.0.1 (singularity)

celery report Output:

software -> celery:5.0.1 (singularity) kombu:5.0.2 py:3.8.5
            billiard:3.6.3.0 py-amqp:5.0.1
platform -> system:Linux arch:64bit, ELF
            kernel version:5.4.0-48-generic imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:pyamqp results:disabled

broker_url: 'amqp://guest:********@localhost:5672//'
deprecated_settings: None
timezone: 'Europe/Paris'
enable_utc: True
beat_schedule: {
    'add-every-10-seconds': {   'args': (16, 16),
                                'schedule': 10.0,
                                'task': 'tasks.add'}}

Steps to Reproduce

The repository https://github.com/PierreF/celery-dst-issue contains code & README to reproduce steps.

But the idea is:

  • Have any tasks running every minutes (I think anything more often than every hour).
  • Start celery beat few minutes before DST end (at least for CET/CEST, probably because the "same" time happen twice. It is 2:00 CEST then one hour later it's 2:00 CET).
  • See that minutely tasks stop running after DST change.

Required Dependencies

I believe version does not matter. I've tested with

  • Minimal Python Version: 3.8.5
  • Minimal Celery Version: master as of 2020-10-26, shown as 5.0.1
  • Minimal Kombu Version: 5.0.2
  • Minimal Broker Version: RabbitMQ 3.8.5
  • Minimal Result Backend Version: none
  • Minimal OS and/or Kernel Version: Ubuntu 20.04 with Linux 5.4.0-48-generic
  • Minimal Broker Client Version: amqp==5.0.1
  • Minimal Result Backend Client Version: none

Python Packages

pip freeze Output:

amqp==5.0.1
appdirs==1.4.3
billiard==3.6.3.0
CacheControl==0.12.6
celery==5.0.1
certifi==2019.11.28
chardet==3.0.4
click==7.1.2
click-didyoumean==0.0.3
click-repl==0.1.6
colorama==0.4.3
contextlib2==0.6.0
distlib==0.3.0
distro==1.4.0
html5lib==1.0.1
idna==2.8
ipaddr==2.2.0
kombu==5.0.2
lockfile==0.12.2
msgpack==0.6.2
packaging==20.3
pep517==0.8.2
progress==1.5
prompt-toolkit==3.0.8
pyparsing==2.4.6
pytoml==0.1.21
pytz==2020.1
requests==2.22.0
retrying==1.3.3
six==1.14.0
urllib3==1.25.8
vine==5.0.0
wcwidth==0.2.5
webencodings==0.5.1

Other Dependencies

Details

N/A

Minimally Reproducible Test Case

See https://github.com/PierreF/celery-dst-issue

Details

sudo apt-get install faketime
git clone https://github.com/PierreF/celery-dst-issue
cd celery-dst-issue
mkvirtualenv -p /usr/bin/python3 celery
pip install celery
docker run -d --name celery-rabbitmq -p 127.0.0.1:5672:5672 rabbitmq:3
rm celerybeat-schedule
faketime '2020-10-25 00:58:30Z' celery -A tasks worker --loglevel=INFO -B

Expected Behavior

The tasks add-every-10-seconds runs every 10 seconds

Actual Behavior

The tasks add-every-10-seconds runs every 10 seconds before the DST change but stop after DST change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions