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

AttributeError: 'DisabledBackend' object has no attribute '_restore_group' #9006

Open
11 of 18 tasks
mahendrap1512 opened this issue May 6, 2024 · 2 comments
Open
11 of 18 tasks

Comments

@mahendrap1512
Copy link

Checklist

  • I have verified that the issue exists against the main branch of Celery.
  • This has already been asked to the discussions forum 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 main 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 main 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: 5.2.7 (dawn-chorus)

celery report Output:

software -> celery:5.2.7 (dawn-chorus) kombu:5.3.7 py:3.8.0
            billiard:3.6.4.0 py-amqp:5.2.0
platform -> system:Linux arch:64bit, ELF
            kernel version:5.10.213-201.855.amzn2.x86_64 imp:CPython
loader   -> celery.loaders.default.Loader
settings -> transport:amqp results:disabled

deprecated_settings: None

Steps to Reproduce

This issue occur intermittently. So don't have the exact steps to replicate.

Setup Details

  1. celery version = 5.2.7
  2. python version = 3.8.0
  3. redis==4.5.4
  4. celery backend = redis (managed service from AWS)
  5. celery message broker = rabbitmq
  6. REDIS_URL is the URL of redis service (properly set, checked by logging it)
  7. BROKER_URL is rabbitmq url (also properly set)

Celery app instantiate

CELERY = Celery('celery_tasks',
                backend=REDIS_URL,
                broker=BROKER_URL)
celery_config = 'celery_config'
CELERY.config_from_object(celery_config)
CELERY.conf.CELERY_RESULT_BACKEND = REDIS_URL

Code (Which is failing error)

        jobs = chord(group(
            CELERY.signature('celery_task_1',
                             kwargs={<kwargs related to celery task 1>}).set(
                queue="queue1") for file in files),
            CELERY.signature('celery_task_2', immutable=True, kwargs={<kwargs related to task 2>}).set(
                queue="queue2"))
        result = jobs.apply_async()

This code is "intermittently" raising following error

raised: AttributeError("'DisabledBackend' object has no attribute '_restore_group'")
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/celery/backends/redis.py", line 488, in on_chord_part_return
    header_result = GroupResult.restore(gid)
  File "/usr/local/lib/python3.8/dist-packages/celery/result.py", line 960, in restore
    return backend.restore_group(id)
  File "/usr/local/lib/python3.8/dist-packages/celery/backends/base.py", line 656, in restore_group
    meta = self.get_group_meta(group_id, cache=cache)
  File "/usr/local/lib/python3.8/dist-packages/celery/backends/base.py", line 649, in get_group_meta
    meta = self._restore_group(group_id)
AttributeError: 'DisabledBackend' object has no attribute '_restore_group'

Required Dependencies

  • Minimal Python Version: 3.8.0
  • Minimal Celery Version: 5.2.7
  • Minimal Kombu Version: 5.3.7
  • Minimal Broker Version: Using managed RabbitMq service
  • Minimal Result Backend Version: Using managed Redis service from AWS
  • Minimal OS and/or Kernel Version: Linux 5.10.213-201.855.amzn2.x86_64
  • Minimal Broker Client Version: amqp==5.2.0
  • Minimal Result Backend Client Version: redis==4.5.4

Python Packages

pip freeze Output:

alembic==1.13.1
amqp==5.2.0
asn1crypto==0.24.0
async-timeout==4.0.3
attrs==23.2.0
awscli==1.27.143
azure-core==1.30.1
azure-storage-blob==12.19.1
backports.zoneinfo==0.2.1
beautifulsoup4==4.12.1
billiard==3.6.4.0
blinker==1.8.1
blis==0.7.11
boto3==1.26.143
botocore==1.29.143
bs4==0.0.2
bytecode==0.15.1
cachetools==5.3.3
catalogue==2.0.10
cattrs==23.2.3
celery==5.2.7
certifi==2024.2.2
cffi==1.16.0
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.7
click-didyoumean==0.3.1
click-plugins==1.1.1
click-repl==0.3.0
colorama==0.4.4
colorclass==2.2.2
compressed-rtf==1.0.6
confection==0.1.4
cryptography==39.0.1
cymem==2.0.8
datefinder==0.7.1
ddsketch==3.0.1
ddtrace==2.8.3
Deprecated==1.2.14
dnspython==2.6.1
docutils==0.16
easygui==0.98.3
ebcdic==1.1.1
elasticsearch==7.0.5
envier==0.5.1
et-xmlfile==1.1.0
exceptiongroup==1.2.1
extract-msg==0.47.0
Flask==2.3.2
Flask-Cors==3.0.10
flask-csrf==0.9.2
Flask-Login==0.4.1
Flask-Migrate==2.5.2
Flask-SQLAlchemy==3.1.1
Flask-WTF==0.14.2
fonttools==4.51.0
fpdf==1.7.2
future==1.0.0
futures==3.1.1
fuzzywuzzy==0.17.0
glob2==0.7
google-api-core==1.34.1
google-api-python-client==1.12.2
google-auth==2.29.0
google-auth-httplib2==0.2.0
google-auth-oauthlib==0.4.1
googleapis-common-protos==1.63.0
googledrivedownloader==0.4
greenlet==3.0.3
httplib2==0.22.0
hyperopt==0.1.2
idna==2.6
img2pdf==0.5.1
importlib-metadata==7.0.0
importlib_resources==6.4.0
isodate==0.6.1
itsdangerous==2.2.0
jdcal==1.4.1
Jinja2==3.1.4
jmespath==1.0.1
joblib==1.4.2
keyring==10.6.0
keyrings.alt==3.0
kombu==5.3.7
langcodes==3.4.0
language_data==1.2.0
lark==1.1.8
lightgbm==2.3.0
lxml==5.2.1
Mako==1.3.3
marisa-trie==1.1.0
MarkupSafe==2.1.5
msgpack-python==0.5.6
msoffcrypto-tool==5.4.0
murmurhash==1.0.10
networkx==3.1
ngram==3.3.2
nltk==3.6.6
numpy==1.21.6
oauth2client==3.0.0
oauthlib==3.2.2
olefile==0.47
oletools==0.60.1
opencv-contrib-python==4.2.0.34
opencv-python==3.4.18.65
openpyxl==2.6.4
opentelemetry-api==1.24.0
packaging==24.0
pandas==1.2.5
pathlib_abc==0.1.1
pathy==0.11.0
pcodedmp==1.2.6
pdf2image==1.6.0
pdfkit==1.0.0
pdftotext==2.1.2
pikepdf==5.1.2
Pillow==9.5.0
preshed==3.0.9
prompt-toolkit==3.0.43
protobuf==3.20.3
psycopg2-binary==2.9.5
pyasn1==0.6.0
pyasn1_modules==0.4.0
pycparser==2.22
pycrypto==2.6.1
pydantic==1.10.15
PyGObject==3.26.1
pymongo==4.7.1
pyodbc==4.0.39
pyparsing==2.4.7
pypdf==4.1.0
PyPDF2==2.10.6
pyspellchecker==0.8.1
pytesseract==0.3.0
python-apt==1.6.6
python-dateutil==2.9.0.post0
python-magic==0.4.27
pytz==2023.3.post1
pyxdg==0.25
PyYAML==5.4.1
rapidfuzz==2.0.3
rarfile==4.1
red-black-tree-mod==1.20
redis==4.5.4
regex==2024.4.28
reportlab==4.2.0
requests==2.31.0
requests-oauthlib==2.0.0
rsa==4.7.2
RTFDE==0.1.1
s3transfer==0.6.2
scikit-learn==0.23.1
scipy==1.10.1
SecretStorage==2.3.1
sentry-sdk==2.0.1
simplejson==3.19.2
six==1.15.0
sklearn==0.0
smart-open==6.4.0
soupsieve==2.5
spacy==3.5.3
spacy-legacy==3.0.12
spacy-loggers==1.0.5
SQLAlchemy==2.0.30
sqlparse==0.5.0
srsly==2.4.8
thinc==8.1.12
threadpoolctl==3.5.0
tqdm==4.38.0
typer==0.7.0
typing_extensions==4.11.0
tzdata==2024.1
tzlocal==5.2
unattended-upgrades==0.1
uritemplate==3.0.1
urllib3==1.26.18
uWSGI==2.0.25.1
vine==5.1.0
wasabi==1.1.2
wcwidth==0.2.13
Werkzeug==2.3.3
wkhtmltopdf==0.2
wrapt==1.16.0
WTForms==3.1.2
xgboost==0.82
xlrd==1.2.0
xmltodict==0.13.0
zipfile36==0.1.3
zipp==3.18.1

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

When I run following code

        jobs = chord(group(
            CELERY.signature('celery_task_1',
                             kwargs={<kwargs related to celery task 1>}).set(
                queue="queue1") for file in files),
            CELERY.signature('celery_task_2', immutable=True, kwargs={<kwargs related to task 2>}).set(
                queue="queue2"))
        result = jobs.apply_async()

It should not fail, and it should not raise any exception
As per my understanding this is happening when celery is trying to write the result in result backend.

Actual Behavior

When above mentioned code run, it fail randomly with the following error.

raised: AttributeError("'DisabledBackend' object has no attribute '_restore_group'")
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/celery/backends/redis.py", line 488, in on_chord_part_return
    header_result = GroupResult.restore(gid)
  File "/usr/local/lib/python3.8/dist-packages/celery/result.py", line 960, in restore
    return backend.restore_group(id)
  File "/usr/local/lib/python3.8/dist-packages/celery/backends/base.py", line 656, in restore_group
    meta = self.get_group_meta(group_id, cache=cache)
  File "/usr/local/lib/python3.8/dist-packages/celery/backends/base.py", line 649, in get_group_meta
    meta = self._restore_group(group_id)
AttributeError: 'DisabledBackend' object has no attribute '_restore_group'
@suryan-s
Copy link

suryan-s commented May 8, 2024

@mahendrap1512 well the DisabledBackend error suggests that Celery doesn't have a result backend configured properly. Have you verified if the connection strings for the REDIS_URL is correct?

Also why is result backend is initialized twice? Its not necessary to do so if the broker URL and backend URL is in the config file

@mahendrap1512 mahendrap1512 closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
@mahendrap1512 mahendrap1512 reopened this May 18, 2024
@mahendrap1512
Copy link
Author

@mahendrap1512 well the DisabledBackend error suggests that Celery doesn't have a result backend configured properly. Have you verified if the connection strings for the REDIS_URL is correct?

Also why is result backend is initialized twice? Its not necessary to do so if the broker URL and backend URL is in the config file

Yeah, I checked the celery result backend is setup properly. Most of the time it works with no issues, it fails intermittently.

Also I checked the code result backend is only initialised once.

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

No branches or pull requests

2 participants