Issue 1:
Duplicate

Issue 2:
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: celery:5.2.3 (dawn-chorus)

celery report Output:

software -> celery:5.2.3 (dawn-chorus) kombu:5.2.3 py:3.9.10
billiard:3.6.4.0 redis:4.1.2
platform -> system:Linux arch:64bit, ELF
kernel version:4.4.0-19041-Microsoft imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:redis results:django-celery-results-backend

Steps to Reproduce

Required Dependencies

Minimal Python Version: N/A or Unknown

Minimal Celery Version: N/A or Unknown

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: 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:

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

All the tasks will be submitted to the queue

Actual Behavior

Hi all, I'm experiencing a weird behavior/bug after upgrading from celery 5.05 to celery 5.2.3.

I'm trying to create a chord that consists of a group of 10 tasks.

When I'm using an iterator to build the celery group, only 2 tasks are published. When I'm using the exact same iterator but converting it to a list, it publishes all the 10 tasks. The same code works under celery 5.0.5.

I'm posting the code I'm running both with celery 5.0.5 and with celery 5.2.3 (no worker is running)

Example on celery 5.2.3:

In [14]: (celery.group(task_a.s(i) for i in range(10)) | task_b.s(999)).apply_async() # note: the group is taking an iterator as input
Out[14]: <AsyncResult: f003701a-3996-4ad8-aeae-13daf9fd1290>

In [15]: redis_client.llen('celery')
Out[15]: 3 # The 3 tasks that are in the queue are the 2 first group tasks + a chord unlock task

In [16]: redis_client.flushdb()
Out[16]: True

In [17]: redis_client.llen('celery')
Out[17]: 0

In [18]: (celery.group([task_a.s(i) for i in range(10)]) | task_b.s(999)).apply_async() # note: the group is taking a list as input
Out[18]: <AsyncResult: 67332373-accb-4ca7-9cb3-3dcd276cacca>

In [19]: redis_client.llen('celery')
Out[19]: 11

celery report:
software -> celery:5.2.3 (dawn-chorus) kombu:5.2.3 py:3.9.10
billiard:3.6.4.0 redis:4.1.2
platform -> system:Linux arch:64bit, ELF
kernel version:4.4.0-19041-Microsoft imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:redis results:django-celery-results-backend

Example on celery 5.0.5:

In [7]: (celery.group(task_a.s(i) for i in range(10)) | task_b.s(999)).apply_async() # note: the group is taking an iterator as input
Out[7]: <AsyncResult: bb395128-1ebb-4181-9def-9d0c26bb88ff>

In [8]: redis_client.llen('celery')
Out[8]: 10

In [9]: redis_client.flushdb()
Out[9]: True

In [10]: redis_client.llen('celery')
Out[10]: 0

In [11]: (celery.group([task_a.s(i) for i in range(10)]) | task_b.s(999)).apply_async() # note: the group is taking a list as input
Out[11]: <AsyncResult: d3344171-3dae-475f-9c5e-895aff5e6be0>

In [12]: redis_client.llen('celery')
Out[12]: 10

celery report:
software -> celery:5.0.5 (singularity) kombu:5.2.3 py:3.9.10
billiard:3.6.4.0 redis:4.1.2
platform -> system:Linux arch:64bit, ELF
kernel version:4.4.0-19041-Microsoft imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:redis results:django-celery-results-backend