Issue 1:
example: pip install celery[sqs] doesn't install kombu[sqs]

thus pycurl ends up to be missing.

What would be the best way to solve this ? knowing that we might be interested by several flavors at the same time like celery[sqs,msgpack].

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: 5.2.6 (dawn-chorus)

celery report
Output:

software -> celery:5.2.6 (dawn-chorus) kombu:5.2.3 py:3.10.0
billiard:3.6.4.0 py-amqp:5.0.9
platform -> system:Windows arch:64bit, WindowsPE
kernel version:10 imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:amqp results:redis://localhost:6379/0

broker_url: 'amqp://user:********@localhost:5672//'
task_create_missing_queues: True
task_acks_late: True
result_extended: True
result_expires: 3600
worker_send_task_events: True
result_backend: 'redis://localhost:6379/0'
deprecated_settings: None

Steps to Reproduce

Create simplest docker compose with redis & rabbitMQ

run app with celery --app=app worker --pool=solo --concurrency=1 -E --loglevel=INFO --queues=my_queue

run python call.py

You see in retried task headers there in no "custom_header": "yumy yum"

Required Dependencies

Minimal Python Version: 3.10.0

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

Application app.py:

from functools import partial
from typing import Final

from celery import Task, Celery

BASE_CELERY_BROKER_URL = "amqp://user:pass@localhost:5672"
CELERY_RESULT_URL = "redis://localhost:6379/0"

def make_celery_worker_app_stub() -> partial[Celery]:
return partial(
Celery,
task_create_missing_queues=True,
task_acks_late=True,
result_extended=True,
result_expires=3600,
worker_send_task_events=True,
)

app: Final = make_celery_worker_app_stub()(
main=__name__,
result_backend=CELERY_RESULT_URL,
broker="%s" % (BASE_CELERY_BROKER_URL),

set_as_current=False,
)

@app.task(
bind=True,
queue="my_queue",
name="my_name:my_function",
acks_late=True,
task_reject_on_worker_lost=True,
autoretry_for=(Exception,),
retry_backoff=True,
max_retries=3,
task_time_limit=8,
)
def failing_function(
self: Task,
data
) -> None:
print(data) # prints hello
print(self.request.properties["application_headers"])

assert False == True

Caller call.py:

from celery import Celery

BASE_CELERY_BROKER_URL = "amqp://user:pass@localhost:5672"
CELERY_RESULT_URL = "redis://localhost:6379/0"

def celery_app(
) -> Celery:
return Celery(
__name__,
result_backend=CELERY_RESULT_URL,
broker="%s" % (BASE_CELERY_BROKER_URL),
task_create_missing_queues=True,
celery_queue_ha_policy="all",
task_acks_late=True,
set_as_current=False,
result_extended=True,
)

client = celery_app()

options = {"headers": {
"custom_header": "yumy yum"
}}

sign = client.signature(
"my_name:my_function",
queue="my_queue",
args=("hello",),
options=options
)
sign.apply_async()

Log:

[2022-05-12 22:37:20,703: INFO/MainProcess] Connected to amqp://user:**@127.0.0.1:5672//
[2022-05-12 22:37:20,736: INFO/MainProcess] mingle: searching for neighbors
[2022-05-12 22:37:21,764: INFO/MainProcess] mingle: all alone
[2022-05-12 22:37:21,799: INFO/MainProcess] celery@DESKTOP-51C03JP ready.
[2022-05-12 22:38:47,431: INFO/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] received
[2022-05-12 22:38:47,432: WARNING/MainProcess] hello
[2022-05-12 22:38:47,432: WARNING/MainProcess] {'lang': 'py', 'task': 'my_name:my_function', 'id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'parent_id': None, 'argsrepr': "('hello',)", 'kwargsrepr': '{}', 'origin': 'gen5572@DESKTOP-51C03JP', 'ignore_result': False, 'custom_header': 'yumy yum'}
[2022-05-12 22:38:47,468: INFO/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] retry: Retry in 1s: AssertionError()
[2022-05-12 22:38:47,469: INFO/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] received
[2022-05-12 22:38:48,446: WARNING/MainProcess] hello
[2022-05-12 22:38:48,447: WARNING/MainProcess] {'lang': 'py', 'task': 'my_name:my_function', 'id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'shadow': None, 'eta': '2022-05-12T20:38:48.433839+00:00', 'expires': None, 'group': None, 'group_index': None, 'retries': 1, 'timelimit': [None, None], 'root_id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'parent_id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'argsrepr': "('hello',)", 'kwargsrepr': '{}', 'origin': 'gen24336@DESKTOP-51C03JP', 'ignore_result': False}
[2022-05-12 22:38:48,470: INFO/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] received
[2022-05-12 22:38:48,473: INFO/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] retry: Retry in 1s: AssertionError()
[2022-05-12 22:38:49,464: WARNING/MainProcess] hello
[2022-05-12 22:38:49,465: WARNING/MainProcess] {'lang': 'py', 'task': 'my_name:my_function', 'id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'shadow': None, 'eta': '2022-05-12T20:38:49.447913+00:00', 'expires': None, 'group': None, 'group_index': None, 'retries': 2, 'timelimit': [None, None], 'root_id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'parent_id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'argsrepr': "('hello',)", 'kwargsrepr': '{}', 'origin': 'gen24336@DESKTOP-51C03JP', 'ignore_result': False}
[2022-05-12 22:38:49,468: INFO/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] received
[2022-05-12 22:38:49,469: WARNING/MainProcess] hello
[2022-05-12 22:38:49,469: INFO/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] retry: Retry in 0s: AssertionError()
[2022-05-12 22:38:49,469: WARNING/MainProcess] {'lang': 'py', 'task': 'my_name:my_function', 'id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 3, 'timelimit': [None, None], 'root_id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'parent_id': 'bb7a8629-00d4-434d-b9d2-72162c2edbbf', 'argsrepr': "('hello',)", 'kwargsrepr': '{}', 'origin': 'gen24336@DESKTOP-51C03JP', 'ignore_result': False}
[2022-05-12 22:38:49,473: ERROR/MainProcess] Task my_name:my_function[bb7a8629-00d4-434d-b9d2-72162c2edbbf] raised unexpected: AssertionError()
Traceback (most recent call last):
File "C:\Users\liman\Anaconda3\envs\dimensions\lib\site-packages\celery\app\trace.py", line 451, in trace_task
R = retval = fun(*args, **kwargs)
File "C:\Users\liman\Anaconda3\envs\dimensions\lib\site-packages\celery\app\trace.py", line 734, in __protected_call__
return self.run(*args, **kwargs)
File "C:\Users\liman\Anaconda3\envs\dimensions\lib\site-packages\celery\app\autoretry.py", line 54, in run
ret = task.retry(exc=exc, **retry_kwargs)
File "C:\Users\liman\Anaconda3\envs\dimensions\lib\site-packages\celery\app\task.py", line 717, in retry
raise_with_context(exc)
File "C:\Users\liman\Anaconda3\envs\dimensions\lib\site-packages\celery\app\autoretry.py", line 34, in run
return task._orig_run(*args, **kwargs)
File "C:\Users\liman\Github\Tests\randoms\api.py", line 48, in failing_function
assert False == True
AssertionError

Expected Behavior

Expecting to keep custom headers when retrying the task

Actual Behavior

Not keeping custom task headers