Skip to content

MongoDB backend TypeError: unsupported type for timedelta seconds component: NoneType #6450

@andreassh

Description

@andreassh

Checklist

  • I have verified that the issue exists against the master branch of Celery.
  • This has already been asked to the discussion group first.
  • [ x] 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: 4.4.6 (cliffs)

celery report Output:

can't disclose that

Steps to Reproduce

Required Dependencies

  • Minimal Python Version: Python 3.8.5
  • Minimal Celery Version: 4.4.6 (cliffs)
  • Minimal Kombu Version: 4.6.11
  • 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:

alembic==1.4.3
amqp==2.6.1
apache-airflow==1.10.12
apispec==1.3.3
appdirs==1.4.4
argcomplete==1.12.0
asgiref==3.2.10
astroid==2.4.2
attrs==19.3.0
Babel==2.8.0
billiard==3.6.3.0
cached-property==1.5.1
cachetools==4.1.1
cattrs==1.0.0
celery==4.4.6
certifi==2020.6.20
cffi==1.14.2
chardet==3.0.4
click==7.1.2
colorama==0.4.3
colorlog==4.0.2
configparser==3.5.3
coreapi==2.3.3
coreschema==0.0.4
croniter==0.3.34
cryptography==3.1
dataclasses==0.6
defusedxml==0.7.0rc1
dill==0.3.2
distlib==0.3.1
Django==3.0.5
django-braces==1.14.0
django-celery-beat==2.0.0
django-celery-results==1.2.1
django-cors-headers==3.5.0
django-debug-toolbar==2.2
django-extensions==3.0.9
django-oauth-toolkit==1.3.2
django-rest-framework-social-oauth2==1.1.0
django-rest-swagger==2.2.0
django-tenant-schemas==1.10.0
django-timezone-field==4.0
djangorestframework==3.11.1
djangorestframework-csv==2.1.0
djongo==1.3.3
dnspython==1.16.0
docutils==0.16
email-validator==1.1.1
eventlet==0.29.0
filelock==3.0.12
Flask==1.1.2
Flask-Admin==1.5.4
Flask-AppBuilder==2.3.4
Flask-Babel==1.0.0
Flask-Caching==1.3.3
Flask-JWT-Extended==3.24.1
Flask-Login==0.4.1
Flask-OpenID==1.2.5
Flask-SQLAlchemy==2.4.4
flask-swagger==0.2.14
Flask-WTF==0.14.3
funcsigs==1.0.2
future==0.18.2
gevent==20.6.2
google-api-core==1.22.2
google-api-python-client==1.11.0
google-auth==1.21.1
google-auth-httplib2==0.0.4
google-auth-oauthlib==0.4.1
google-cloud-core==1.4.1
google-cloud-logging==1.15.1
google-cloud-tasks==2.0.0
googleapis-common-protos==1.52.0
graphviz==0.14.1
greenlet==0.4.16
grpc-google-iam-v1==0.12.3
grpcio==1.32.0
gunicorn==20.0.4
httplib2==0.18.1
hvac==0.10.5
idna==2.10
iso8601==0.1.13
isort==5.5.2
itsdangerous==1.1.0
itypes==1.2.0
Jinja2==2.11.2
json-merge-patch==0.2
jsonschema==3.2.0
kombu==4.6.11
lazy-object-proxy==1.4.3
libcst==0.3.10
lockfile==0.12.2
Mako==1.1.3
Markdown==2.6.11
MarkupSafe==1.1.1
marshmallow==2.21.0
marshmallow-enum==1.5.1
marshmallow-sqlalchemy==0.23.1
mccabe==0.6.1
monotonic==1.5
mypy-extensions==0.4.3
mysqlclient==2.0.1
natsort==7.0.1
numpy==1.19.2
oauthlib==3.1.0
openapi-codec==1.3.2
ordered-set==4.0.2
pandas==1.1.2
pbr==5.5.0
pendulum==1.4.4
prison==0.1.3
proto-plus==1.9.1
protobuf==3.13.0
psutil==5.7.2
psycopg2==2.8.6
psycopg2-binary==2.8.6
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pydot==1.4.1
Pygments==2.7.1
pygraphviz==1.6
PyJWT==1.7.1
pylint==2.6.0
pymongo==3.11.0
pyOpenSSL==19.1.0
pyparsing==2.4.7
pyrsistent==0.17.3
python-crontab==2.5.1
python-daemon==2.2.4
python-dateutil==2.8.1
python-editor==1.0.4
python-nvd3==0.15.0
python-slugify==4.0.1
python3-openid==3.2.0
pytz==2020.1
pytzdata==2020.1
PyYAML==5.3.1
redis==3.5.3
requests==2.24.0
requests-oauthlib==1.3.0
rsa==4.6
scout-apm==2.16.1
sentry-sdk==0.17.4
setproctitle==1.1.10
simplejson==3.17.2
six==1.15.0
social-auth-app-django==3.4.0
social-auth-core==3.3.3
SQLAlchemy==1.3.19
SQLAlchemy-JSONField==0.9.0
SQLAlchemy-Utils==0.36.8
sqlparse==0.2.4
stevedore==3.2.1
tabulate==0.8.7
tenacity==4.12.0
text-unidecode==1.3
thrift==0.13.0
toml==0.10.1
typing-extensions==3.7.4.3
typing-inspect==0.6.0
tzlocal==1.5.1
unicodecsv==0.14.1
uritemplate==3.0.1
urllib3==1.25.10
vine==1.3.0
virtualenv==20.0.31
virtualenv-clone==0.5.4
virtualenvwrapper==4.8.4
Werkzeug==0.16.1
wrapt==1.12.1
WTForms==2.3.3
zope.deprecation==4.4.0
zope.event==4.4
zope.interface==5.1.0

Other Dependencies

Details

N/A

Minimally Reproducible Test Case

Details

Expected Behavior

Celery task is executed successfully

Actual Behavior

Fails with TypeError:

Task celery.backend_cleanup[75aa0973-534f-4812-a992-1ead4086f58c] raised unexpected: TypeError('unsupported type for timedelta seconds component: NoneType')
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/kombu/utils/objects.py", line 42, in __get__
    return obj.__dict__[self.__name__]
KeyError: 'expires_delta'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/celery/app/trace.py", line 412, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/celery/app/trace.py", line 704, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/celery/app/builtins.py", line 25, in backend_cleanup
    app.backend.cleanup()
  File "/usr/local/lib/python3.9/site-packages/celery/backends/mongodb.py", line 258, in cleanup
    {'date_done': {'$lt': self.app.now() - self.expires_delta}},
  File "/usr/local/lib/python3.9/site-packages/kombu/utils/objects.py", line 44, in __get__
    value = obj.__dict__[self.__name__] = self.__get(obj)
  File "/usr/local/lib/python3.9/site-packages/celery/backends/mongodb.py", line 312, in expires_delta
    return timedelta(seconds=self.expires)
TypeError: unsupported type for timedelta seconds component: NoneType

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions