Issue 1:
Checklist

[x ] I have checked the issues list

for similar or identical bug reports.

[x ] I have checked the pull requests list

for existing proposed fixes.

[x ] I have checked the commit log

to find out if the bug was already fixed in the master branch.

[x ] I have included all related issues and possible duplicate issues in this issue

(If there are none, check this box anyway).

Currently using Celery 4.2.1 with Redis 2.10.6.

Description

I have two workers, backgroundworker which consumes the queues regular and important, and importantworker which consumers only the queue important:

backgroundworker: celery -A my_app worker -c 6 -Q regular, important -l info -Ofair
importantworker: celery -A my_app worker -c 6 -Q important -l info -Ofair

There are instances when there are already 1000s of tasks being sent to the regular queue, and therefore handled exclusively by backgroundworker, but when a task is sent to the important queue, it is still handled by backgroundworker and not by importantworker, even though the former should be "busy" (or busier..).

Is this intended? anyway to mitigate that? I was pretty sure that before Celery would route this task to the worker which was consuming less tasks (in this case importantworker), in hopes to "balance the load".

Suggestions

If this is intended, is there anywhere where I can read more about how Celery routes tasks in this scenario? (this scenario: multiple separate workers sharing some of their queues, not the other way around)

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

software -> celery:5.2.3 (dawn-chorus) kombu:5.2.3 py:3.7.12
billiard:3.6.4.0 N/A:N/A
platform -> system:Linux arch:64bit
kernel version:5.10.16.3-microsoft-standard-WSL2 imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:azureservicebus results:azureblockblob://REDACTED

broker_url: 'azureservicebus://RootManageSharedAccessKey:********@REDACTED'
result_backend: 'azureblockblob://REDACTED'
azureblockblob_container_name: 'celery-result-store'
deprecated_settings: None

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:

amqp==5.0.9
azure-common==1.1.27
azure-core==1.21.1
azure-servicebus==7.5.0
azure-storage-blob==12.9.0
billiard==3.6.4.0
Brotli==1.0.9
cached-property==1.5.2
celery==5.2.3
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.10
click==8.0.3
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
cryptography==36.0.1
dash==2.0.0
dash-core-components==2.0.0
dash-extensions==0.0.67
dash-html-components==2.0.0
dash-renderer==1.4.0
dash-table==5.0.0
Deprecated==1.2.13
EditorConfig==0.12.3
Flask==2.0.2
Flask-Caching==1.10.1
Flask-Compress==1.10.1
future==0.18.2
gunicorn==20.1.0
idna==3.3
importlib-metadata==4.10.1
isodate==0.6.1
itsdangerous==2.0.1
Jinja2==3.0.3
jsbeautifier==1.14.0
kombu==5.2.3
MarkupSafe==2.0.1
more-itertools==8.12.0
msrest==0.6.21
oauthlib==3.1.1
packaging==21.3
plotly==5.5.0
prompt-toolkit==3.0.24
pycparser==2.21
pyparsing==3.0.6
python-dotenv==0.19.2
pytz==2021.3
queues==0.6.3
redis==4.1.1
requests==2.27.1
requests-oauthlib==1.3.0
six==1.16.0
tenacity==8.0.1
typing-extensions==4.0.1
uamqp==1.5.1
urllib3==1.26.8
vine==5.0.0
wcwidth==0.2.5
Werkzeug==2.0.2
wrapt==1.13.3
zipp==3.7.0

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

No error

Actual Behavior

I am trying to setup celery using the azureservicebus broker option. If I use redis (or rabbitmq) as the broker, my code works, but when I try to use azureservicebus I get the following error,

[2022-01-19 12:53:44,400: ERROR/MainProcess] Task handler raised error: TypeError('no default __reduce__ due to non-trivial __cinit__')
Traceback (most recent call last):
File "/.../venv/lib/python3.9/site-packages/billiard/pool.py", line 596, in body
put(task)
File "/.../venv/lib/python3.9/site-packages/billiard/connection.py", line 233, in send
self._send_bytes(ForkingPickler.dumps(obj))
File "/.../venv/lib/python3.9/site-packages/billiard/reduction.py", line 56, in dumps
cls(buf, protocol).dump(obj)
File "stringsource", line 2, in uamqp.c_uamqp.CompositeValue.__reduce_cython__
TypeError: no default __reduce__ due to non-trivial __cinit__

I have debugged the issue and found that the error occurs when the billiard.reduction.ForkingPickler.dumps function is called on the azure.servicebus.ServiceBusReceivedMessage object. It this seems to be an issue with this object not supporting the serialization protocol.

As a side note, I tested my connection string using the kombu examples, and they work. So I guess the issue shouldn't be related to my azureservicebus configuration. I also tried different Python version (3.7 and 3.9).