Skip to content

Error "Recursive result parents" on some tasks trees #8890

@beneltayar

Description

@beneltayar

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 Celer
    y.
  • 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.4.0rc1

celery report Output:

software -> celery:5.4.0rc1 (opalescent) kombu:5.3.5 py:3.11.8
            billiard:4.2.0 memory:N/A
platform -> system:Windows arch:64bit, WindowsPE
            kernel version:10 imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:memory results:cache+memory:///

broker_url: 'memory://localhost//'
broker_backend: 'memory:///'
result_backend: 'cache+memory:///'
deprecated_settings: None

Steps to Reproduce

import celery

celery_app = celery.Celery()
celery_app.config_from_object({
    'broker_url': 'memory://',
    'broker_backend': 'memory://',
    'result_backend': 'cache+memory://'
})


@celery.shared_task
def test_task(x: int):
    print(x)


def main():
    t1 = celery.chain(test_task.s(0), celery.group(test_task.s(1), test_task.s(2)), test_task.s(3) | test_task.s(4))
    t2 = celery.chord([test_task.s(5), test_task.s(6)], t1)
    t3 = celery.chord([test_task.s(7)], t2)
    t3.apply_async()


if __name__ == '__main__':
    main()

Required Dependencies

  • Minimal Python Version: 3.9 / 3.11
  • Minimal Celery Version: 5.3.1 / 5.3.4 / 5.3.6 / 5.4.0rc1
  • Minimal Kombu Version: N/A or Unknown
  • Minimal Broker Version: N/A or Unknown
  • Minimal Result Backend Version: N/A or Unknown
  • Minimal OS and/or Kernel Version: Windows 11 / MacOS / Linux
  • Minimal Broker Client Version: N/A or Unknown
  • Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

amqp==5.2.0
billiard==4.2.0
-e git+https://github.com/celery/celery.git@9edeab6b4526a59bf699df10f1b48ac65809eaea#egg=celery
click==8.1.7
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.3.0
colorama==0.4.6
kombu==5.3.5
prompt-toolkit==3.0.43
python-dateutil==2.9.0.post0
six==1.16.0
tzdata==2024.1
vine==5.1.0
wcwidth==0.2.13

Other Dependencies

Details

N/A

Minimally Reproducible Test Case

Same as "Steps to Reproduce"

Expected Behavior

The code runs successfully

Actual Behavior

Traceback (most recent call last):
  File "scratch.py", line 20, in <module>
    t3.apply_async()
  File "C:\git\celery\celery\canvas.py", line 2152, in apply_async
    return self.run(tasks, body, args, task_id=task_id, kwargs=kwargs, **merged_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\git\celery\celery\canvas.py", line 2233, in run
    bodyres = body.freeze(task_id, root_id=root_id)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\git\celery\celery\canvas.py", line 2093, in freeze
    raise RuntimeError('Recursive result parents')
RuntimeError: Recursive result parents

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions