Skip to content

Error using update_state with Arangodb backend #7039

Closed

Description

@pikachupichu25

Checklist

  • I have verified that the issue exists against the master 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 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: 5.0.0

celery report Output:

[2021-11-03 08:16:01,856: ERROR/ForkPoolWorker-2] Error in:
1: INSERT { task: {"status": "PROGRESS", "result": {"progress": 1}, "traceback": null, "children": [], "date_done": null, "task_id": "a5320fd7-b2ed-4c03-bbb8-55d7a6ac4394"}, _key: "celery-task-meta-a5320fd7-b2ed-4c03-bbb8-5
5d7a6ac4394" } INTO celery.
->AQL: unique constraint violated - in index primary of type primary over '_key'; conflicting key: celery-task-meta-a5320fd7-b2ed-4c03-bbb8-55d7a6ac4394 (while executing). Errors: {'code': 409, 'error': True, 'errorMessage': "AQL: unique constraint violated - in in
dex primary of type primary over '_key'; conflicting key: celery-task-meta-a5320fd7-b2ed-4c03-bbb8-55d7a6ac4394 (while executing)", 'errorNum': 1210}

Steps to Reproduce

Required Dependencies

  • Minimal Python Version: 3.8
  • Minimal Celery Version: 5.0.0
  • Minimal Kombu Version: 5.0.2
  • 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:

``` amqp==5.0.6 attrs==19.3.0 Automat==0.8.0 beautifulsoup4==4.9.3 billiard==3.6.4.0 blinker==1.4 blis==0.7.4 boto3==1.17.61 botocore==1.20.61 bs4==0.0.1 cachetools==4.2.1 catalogue==1.0.0 celery==5.0.0 certifi==2020.12.5 chardet==4.0.0 click==7.1.2 click-didyoumean==0.0.3 click-plugins==1.1.1 click-repl==0.1.6 cloud-init==20.4 colorama==0.4.3 command-not-found==0.3 configobj==5.0.6 constantly==15.1.0 cryptography==2.8 cymem==2.0.5 cytoolz==0.11.0 dataclasses==0.6 DateTime==4.3 dbus-python==1.2.16 decorator==4.4.2 distro==1.4.0 distro-info===0.23ubuntu1 ec2-hibinit-agent==1.0.0 en-core-web-lg==2.3.1 en-core-web-md==2.3.1 en-core-web-sm==2.3.1 entrypoints==0.3 filelock==3.0.12 Flask==1.1.2 Flask-WTF==0.14.3 future==0.18.2 hibagent==1.0.1 httplib2==0.14.0 huggingface-hub==0.1.2 hyperlink==19.0.0 idna==2.10 importlib-metadata==4.0.1 incremental==16.10.1 itsdangerous==1.1.0 jellyfish==0.8.2 Jinja2==2.11.3 jmespath==0.10.0 joblib==1.0.1 jsonpatch==1.22 jsonpointer==2.0 jsonschema==3.2.0 keyring==18.0.1 kombu==5.0.2 language-selector==0.1 launchpadlib==1.10.13 lazr.restfulclient==0.14.2 lazr.uri==1.0.3 MarkupSafe==1.1.1 more-itertools==4.2.0 murmurhash==1.0.5 netifaces==0.10.4 networkx==2.5.1 nltk==3.6.2 numpy==1.20.2 oauthlib==3.1.0 packaging==20.9 pexpect==4.6.0 Pillow==8.4.0 plac==1.1.3 pprofile==2.0.5 preshed==3.0.5 prompt-toolkit==3.0.18 protobuf==3.15.8 psutil==5.8.0 pyArango==1.3.4 pyasn1==0.4.2 pyasn1-modules==0.2.1 pycurl==7.43.0.5 pyemd==0.5.1 PyGObject==3.36.0 PyHamcrest==1.9.0 PyJWT==1.7.1 pymacaroons==0.13.0 PyNaCl==1.3.0 pyOpenSSL==19.0.0 pyparsing==2.4.7 Pyphen==0.10.0 pyrsistent==0.15.5 pyserial==3.4 python-apt==2.0.0+ubuntu0.20.4.4 python-dateutil==2.8.1 python-debian===0.1.36ubuntu1 pytz==2021.1 PyYAML==5.3.1 redis==3.5.3 regex==2021.4.4 requests==2.25.1 requests-unixsocket==0.2.0 s3transfer==0.4.2 sacremoses==0.0.45 scikit-learn==0.24.1 scipy==1.6.3 SecretStorage==2.3.1 segtok==1.5.10 sentence-transformers==2.1.0 sentencepiece==0.1.95 service-identity==18.1.0 simplejson==3.16.0 six==1.15.0 sortedcontainers==2.3.0 sos==4.0 soupsieve==2.2.1 spacy==2.3.5 srsly==1.0.5 ssh-import-id==5.10 stanza==1.2 stem==1.8.0 systemd-python==234 tabulate==0.8.9 textacy==0.10.1 thinc==7.4.5 threadpoolctl==2.1.0 tokenizers==0.10.3 toolz==0.11.1 torch==1.8.1 torchvision==0.11.1 tqdm==4.60.0 transformers==4.12.3 Twisted==18.9.0 typing-extensions==3.7.4.3 ubuntu-advantage-tools==20.3 ufw==0.36 unattended-upgrades==0.1 urllib3==1.26.4 vine==5.0.0 wadllib==1.3.3 wasabi==0.8.2 wcwidth==0.2.5 Werkzeug==1.0.1 WTForms==2.3.3 yake==0.4.8 zipp==3.4.1 zope.interface==5.3.0 ```

Other Dependencies

Details

None

Minimally Reproducible Test Case

Details

from celery import Celery
import time
celery_app = Celery('tasks', broker='...',  backend='ARANGODB...')
@celery_app.task(name="my_task")
def my_task():
	for i in range(10);
		my_task.update_state(state="PROGRESS", meta={'progress': i})
		time.sleep(2)

result = my_task.apply_async()
while not result.successful():
	print(result.state)
	time.sleep(2)

Expected Behavior

I create a task with update_state using ArangoDB backend. I think it should update the current state in the same document of ArangoDB and I should be able to retrieve the most recent update from the database.

Actual Behavior

I cannot receive the updated state and find this error for every update_state perform when update_state to ArangoDB backend.
It seems that the the first state update already take the _key and ArangoDB does not allow to write data with the same key. If the code use 'overwrite', it should solve the issue.

This is one of the error message I got.

[2021-11-03 08:16:01,856: ERROR/ForkPoolWorker-2] Error in:
1: INSERT { task: {"status": "PROGRESS", "result": {"progress": 1}, "traceback": null, "children": [], "date_done": null, "task_id": "a5320fd7-b2ed-4c03-bbb8-55d7a6ac4394"}, _key: "celery-task-meta-a5320fd7-b2ed-4c03-bbb8-5
5d7a6ac4394" } INTO celery.
->AQL: unique constraint violated - in index primary of type primary over '_key'; conflicting key: celery-task-meta-a5320fd7-b2ed-4c03-bbb8-55d7a6ac4394 (while executing). Errors: {'code': 409, 'error': True, 'errorMessage': "AQL: unique constraint violated - in in
dex primary of type primary over '_key'; conflicting key: celery-task-meta-a5320fd7-b2ed-4c03-bbb8-55d7a6ac4394 (while executing)", 'errorNum': 1210}

Activity

  1. open-collective-bot commented on Nov 3, 2021

    @open-collective-bot

    Hey @pikachupichu25 👋,
    Thank you for opening an issue. We will get back to you as soon as we can.
    Also, check out our Open Collective and consider backing us - every little helps!

    We also offer priority support for our sponsors.
    If you require immediate assistance please consider sponsoring us.

  2. thedrow commented on Dec 13, 2021

    @thedrow
    Contributor

    Could you please at least provide a minimally reproducible test case so we can reproduce the issue?

  3. pikachupichu25 commented on Dec 28, 2021

    @pikachupichu25
    Author
  4. thedrow commented on Jan 17, 2022

    @thedrow
    Contributor

    @pikachupichu25 I've added the test case to the original issue. Could you please also include all other missing information in the original issue per the template?
    This will help us reproduce the problem.

  5. pikachupichu25 commented on Jan 21, 2022

    @pikachupichu25
    Author

    @pikachupichu25 I've added the test case to the original issue. Could you please also include all other missing information in the original issue per the template? This will help us reproduce the problem.

    I add the information I know. My pip freeze might contain a lot of package not relating to this test case though.

  6. added 6 commits that reference this issue on Jul 1, 2023
    422dd53
    1c99ec4
    3b566c9
    b34b45a
    cc4a4e1
    82e54f2
  7. added a commit that references this issue on Jul 29, 2023
  8. added this to the 5.3.x milestone on Jul 29, 2023
  9. moved this from Low Priority to Done in v5.3on Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions