Repository navigation
Description
Checklist
- I have verified that the issue exists against the
mainbranch of Celery. - This has already been asked to the [discussions forum](https://github.com/celery/celery/discussions) first.
- I have read the relevant section in the
[contribution guide](https://docs.celeryq.dev/en/main/contributing.html#other-bugs)
on reporting bugs. - I have checked the [issues list](https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22)
for similar or identical bug reports. - I have checked the [pull requests list](https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22)
for existing proposed fixes. - I have checked the [commit log](https://github.com/celery/celery/commits/main)
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). - I have tried to reproduce the issue with [pytest-celery](https://docs.celeryq.dev/projects/pytest-celery/en/latest/userguide/celery-bug-report.html) and added the reproduction script below.
Mandatory Debugging Information
- I have verified that the issue exists against the
mainbranch of Celery. - I have included the output of
celery -A proj reportin the issue. - I have specified the Celery version affected below.
- I have included the contents of
pip freezein the issue. - I have included the versions of the external dependencies relevant to reproducing 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 found.
Possible Duplicates
- None found.
Environment & Settings
Celery version: 5.7.0a1 (current main)
celery report Output:
Not available; issue reproduced directly against the current Celery main branch.
Steps to Reproduce
Required Dependencies
- Minimal Python Version: Python version used by the test environment
- Minimal Celery Version:
5.7.0a1/ currentmain - Minimal Kombu Version: N/A
- Minimal Broker Version: N/A
- Minimal Result Backend Version: ArangoDB
- Minimal OS and/or Kernel Version: N/A
- Minimal Broker Client Version: N/A
- Minimal Result Backend Client Version: pyArango version used by the environment
Python Packages
pip freeze Output:
Not included; the issue is isolated to the ArangoDB backend implementation.
Other Dependencies
Details
ArangoDB is required to reproduce the backend behavior.
The relevant backend implementation is:
celery/backends/arangodb.py
Minimally Reproducible Test Case
The issue occurs when ArangoDbBackend.delete() attempts to remove a key that does not exist.
The current implementation executes:
def delete(self, key):
if key is None:
return
self.db.AQLQuery(
"REMOVE {_key: @key} IN @@collection",
bindVars={
"@collection": self.collection,
"key": key,
},
)A minimal reproduction is:
backend.delete("key-that-does-not-exist")When the key does not exist in the ArangoDB collection, ArangoDB raises ERROR_ARANGO_DOCUMENT_NOT_FOUND (error code 1202), which is surfaced by pyArango as an AQLQueryError.
The same problem can be reached through:
AsyncResult(task_id).forget()when the corresponding result document is already absent.
Expected Behavior
ArangoDbBackend.delete() should be safe to call when the requested key does not exist.
Deleting an already-absent result should behave as an idempotent no-op rather than raising an uncaught backend exception.
In particular:
AsyncResult(task_id).forget()should not fail merely because the corresponding result document is already absent.
Actual Behavior
ArangoDbBackend.delete() executes an AQL REMOVE without ignoreErrors.
When the requested document does not exist, ArangoDB raises:
ERROR_ARANGO_DOCUMENT_NOT_FOUND
which is surfaced by pyArango as an AQLQueryError.
This causes forget() to propagate the backend exception instead of completing as a no-op.
The relevant query is currently:
REMOVE {_key: @key} IN @@collectionArangoDB supports suppressing this specific missing-document error using:
OPTIONS { ignoreErrors: true }A regression test for the missing-document case passes after adding this option, together with the existing ArangoDB backend tests (14 tests total).
Activity