Issue 1:
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.

Steps to Reproduce

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

python3 -sBm build -w --no-isolation

because I'm calling build with --no-isolation I'm using during all processes only locally installed modules

install .whl file in </install/prefix>

run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-celery-5.2.6-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-celery-5.2.6-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --ignore t/unit/backends/test_mongodb.py --ignore t/unit/backends/test_mongod.py --ignore t/unit/backends/test_s3.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/celery-5.2.6, configfile: pytest.ini
plugins: subtests-0.7.0, timeout-2.1.0
collected 140 items / 1 error / 7 skipped

================================================================================== ERRORS ==================================================================================
___________________________________________________________ ERROR collecting t/unit/concurrency/test_prefork.py ____________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/concurrency/test_prefork.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
t/unit/concurrency/test_prefork.py:11: in <module>
from celery.concurrency.asynpool import iterate_file_descriptors_safely
celery/concurrency/asynpool.py:29: in <module>
from billiard.compat import buf_t, isblocking, setblocking
E ImportError: cannot import name 'buf_t' from 'billiard.compat' (/usr/lib/python3.8/site-packages/billiard/compat.py)
============================================================================= warnings summary =============================================================================
t/integration/test_canvas.py:39
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/integration/test_canvas.py:39: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
_flaky = pytest.mark.flaky(reruns=5, reruns_delay=1, cause=is_retryable_exception)

t/integration/test_inspect.py:15
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/integration/test_inspect.py:15: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
_flaky = pytest.mark.flaky(reruns=5, reruns_delay=2)

t/integration/test_tasks.py:18
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/integration/test_tasks.py:18: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
_flaky = pytest.mark.flaky(reruns=5, reruns_delay=2)

t/unit/app/test_app.py:919
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/app/test_app.py:919: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('multiprocessing.util')

t/unit/app/test_loaders.py:122
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/app/test_loaders.py:122: PytestUnknownMarkWarning: Unknown pytest.mark.patched_environ - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.patched_environ('CELERY_CONFIG_MODULE', 'celeryconfig.py')

t/unit/app/test_log.py:187
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/app/test_log.py:187: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('billiard.util')

t/unit/backends/test_cache.py:209
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cache.py:209: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('pylibmc')

t/unit/backends/test_cache.py:218
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cache.py:218: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('pylibmc', 'memcache')

t/unit/backends/test_cache.py:244
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cache.py:244: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('pylibmc')

t/unit/backends/test_cache.py:255
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cache.py:255: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('pylibmc')

t/unit/backends/test_cassandra.py:28
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cassandra.py:28: PytestUnknownMarkWarning: Unknown pytest.mark.patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.patched_module(*CASSANDRA_MODULES)

t/unit/backends/test_cassandra.py:40
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cassandra.py:40: PytestUnknownMarkWarning: Unknown pytest.mark.patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.patched_module(*CASSANDRA_MODULES)

t/unit/backends/test_cassandra.py:63
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cassandra.py:63: PytestUnknownMarkWarning: Unknown pytest.mark.patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.patched_module(*CASSANDRA_MODULES)

t/unit/backends/test_cassandra.py:69
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cassandra.py:69: PytestUnknownMarkWarning: Unknown pytest.mark.patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.patched_module(*CASSANDRA_MODULES)

t/unit/backends/test_cassandra.py:100
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/backends/test_cassandra.py:100: PytestUnknownMarkWarning: Unknown pytest.mark.patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.patched_module(*CASSANDRA_MODULES)

t/unit/fixups/test_django.py:57
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/fixups/test_django.py:57: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('django')

t/unit/fixups/test_django.py:268
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/fixups/test_django.py:268: PytestUnknownMarkWarning: Unknown pytest.mark.patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.patched_module('django', 'django.db', 'django.core',

t/unit/utils/test_serialization.py:20
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/utils/test_serialization.py:20: PytestUnknownMarkWarning: Unknown pytest.mark.masked_modules - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.masked_modules('cPickle')

t/unit/worker/test_autoscale.py:103
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/worker/test_autoscale.py:103: PytestUnknownMarkWarning: Unknown pytest.mark.sleepdeprived_patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.sleepdeprived_patched_module(autoscale)

t/unit/worker/test_autoscale.py:219
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/worker/test_autoscale.py:219: PytestUnknownMarkWarning: Unknown pytest.mark.sleepdeprived_patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.sleepdeprived_patched_module(autoscale)

t/unit/worker/test_worker.py:806
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/worker/test_worker.py:806: PytestUnknownMarkWarning: Unknown pytest.mark.sleepdeprived_patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.sleepdeprived_patched_module(autoscale)

t/unit/worker/test_worker.py:855
/home/tkloczko/rpmbuild/BUILD/celery-5.2.6/t/unit/worker/test_worker.py:855: PytestUnknownMarkWarning: Unknown pytest.mark.sleepdeprived_patched_module - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.sleepdeprived_patched_module(autoscale)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] t/integration/test_backend.py:8: could not import 'azure': No module named 'azure'
SKIPPED [1] t/unit/backends/test_arangodb.py:17: could not import 'pyArango': No module named 'pyArango'
SKIPPED [1] t/unit/backends/test_azureblockblob.py:12: could not import 'azure.storage.blob': No module named 'azure'
SKIPPED [1] t/unit/backends/test_consul.py:7: could not import 'consul': No module named 'consul'
SKIPPED [1] t/unit/backends/test_cosmosdbsql.py:12: could not import 'pydocumentdb': No module named 'pydocumentdb'
SKIPPED [1] t/unit/backends/test_couchbase.py:20: could not import 'couchbase': No module named 'couchbase'
SKIPPED [1] t/unit/backends/test_couchdb.py:18: could not import 'pycouchdb': No module named 'pycouchdb'
ERROR t/unit/concurrency/test_prefork.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================= 7 skipped, 22 warnings, 1 error in 4.90s =================================================================

List of modules installed in build env

Package Version
----------------------------- -----------------
alabaster 0.7.12
amqp 5.1.1
async-timeout 4.0.2
attrs 21.4.0
Babel 2.10.1
billiard 4.0.0
boto3 1.22.5
botocore 1.25.5
Brlapi 0.8.3
build 0.7.0
certifi 2021.10.8
cffi 1.15.0
charset-normalizer 2.0.12
click 8.1.2
click-didyoumean 0.3.0
codespell 2.1.0
cryptography 36.0.2
cycler 0.11.0
Deprecated 1.2.13
distro 1.7.0
dnspython 2.2.1
docutils 0.17.1
elastic-transport 8.1.2
elasticsearch 8.1.3
eventlet 0.33.0
extras 1.0.0
fixtures 4.0.0
fonttools 4.33.3
future 0.18.2
gevent 21.12.0
gpg 1.17.1-unknown
greenlet 1.1.2
idna 3.3
imagesize 1.3.0
importlib-metadata 4.11.3
iniconfig 1.1.1
Jinja2 3.1.1
jmespath 1.0.0
kiwisolver 1.3.2
kombu 5.2.4
libcomps 0.1.18
louis 3.21.0
MarkupSafe 2.1.1
matplotlib 3.5.1
msgpack 1.0.3
numpy 1.22.3
olefile 0.46
packaging 21.3
pbr 5.8.1
pep517 0.12.0
Pillow 9.1.0
pip 22.0.4
pluggy 1.0.0
ply 3.11
py 1.11.0
pycparser 2.21
Pygments 2.12.0
PyGObject 3.42.1
pyparsing 3.0.8
pytest 7.1.2
pytest-subtests 0.7.0
pytest-timeout 2.1.0
python-dateutil 2.8.2
pytz 2022.1
PyYAML 6.0
redis 4.2.2
requests 2.27.1
rpm 4.17.0
s3transfer 0.5.2
setuptools 62.0.0
six 1.16.0
snowballstemmer 2.2.0
Sphinx 4.5.0
sphinx-celery 2.0.0
sphinx-click 4.0.0
sphinxcontrib-applehelp 1.0.2.dev20220410
sphinxcontrib-devhelp 1.0.2.dev20220410
sphinxcontrib-htmlhelp 2.0.0
sphinxcontrib-jsmath 1.0.1.dev20220410
sphinxcontrib-qthelp 1.0.3.dev20220410
sphinxcontrib-serializinghtml 1.1.5
SQLAlchemy 1.4.36.dev0
testtools 2.5.0
tomli 2.0.1
urllib3 1.26.9
vine 5.0.0
wheel 0.37.1
wrapt 1.14.0
zipp 3.8.0
zope.event 4.5.0
zope.interface 5.4.0

Issue 2:
Checklist

I have verified that the issue exists against the master branch of Celery.

This has already been asked to the discussion group 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. (Yeah, the bug's just closed #5678 )

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

#5678

Possible Duplicates

#5678

Environment & Settings

Celery version: 4.4.0 (cliffs)

celery report Output:

software -> celery:4.4.0 (cliffs) kombu:4.6.7 py:3.6.9
billiard:3.6.1.0 py-amqp:2.5.2
platform -> system:Linux arch:64bit, ELF
kernel version:4.15.0-88-generic imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:pyamqp results:rpc://guest:**@localhost:5672//

accept_content: ['json']
broker_url: 'amqp://guest:********@localhost:5672//'
broker_use_ssl: {
'ca_certs': '/home/n0g/certs/privates/home/testca/ca_certificate.pem',
'cert_reqs': <VerifyMode.CERT_OPTIONAL: 1>,
'certfile': '/home/n0g/certs/privates/home/server/server_certificate.pem',
'keyfile': '********',
'ssl_version': <_SSLMethod.PROTOCOL_TLS: 2>}
enable_utc: True
imports:
('*********************',)
os: <module 'os' from '/usr/lib/python3.6/os.py'>
result_backend: 'rpc://guest:********@localhost:5672//'
result_persistent: True
result_serializer: 'json'
ssl: <module 'ssl' from '/usr/lib/python3.6/ssl.py'>
task_annotations: {
'***********************************': { 'rate_limit': '6/h',
'serializer': 'json'}}
task_serializer: 'json'
timezone: 'UTC'

But let's try a run output too

-------------- celery@nginsburg-desktop v4.4.0 (cliffs)
--- ***** -----
-- ******* ---- Linux-4.15.0-88-generic-x86_64-with-Ubuntu-18.04-bionic 2020-02-25 12:53:38
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app: __main__:0x7fd0390eb160
- ** ---------- .> transport: amqp://guest:**@localhost:5672//
- ** ---------- .> results: rpc://
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
-------------- [queues]
.> celery exchange=celery(direct) key=celery

[tasks]
. ***************************

[2020-02-25 12:53:39,235: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:852).
Trying again in 2.00 seconds... (1/100)

Steps to Reproduce

setup rabbitmq for tls

setup a celery app to use rabbitmq and rpc

try to run the celery app

Required Dependencies

Minimal Python Version: 3.6.9

Minimal Celery Version: 4.4.0

Minimal Kombu Version: 4.6.7

Minimal Broker Version: RabbitMQ 3.8.2

Minimal Result Backend Version: amqp 2.5.2

al OS and/or Kernel Version**: 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Minimal Broker Client Version: N/A or Unknown

Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

amqp==2.5.2
APScheduler==3.6.3
asn1crypto==1.3.0
astroid==2.3.3
attrs==19.3.0
bcrypt==3.1.7
billiard==3.6.1.0
blinker==1.4
celery==4.4.0
certifi==2019.11.28
cffi==1.13.2
chardet==3.0.4
cli-helpers==1.2.1
Click==7.0
configobj==5.0.6
cryptography==2.8
decorator==4.4.1
docopt==0.6.2
enum34==1.1.6
filelock==3.0.12
Flask==1.1.1
Flask-SQLAlchemy==2.4.1
genson==1.1.0
gunicorn==20.0.4
humanize==0.5.1
idna==2.8
importlib-metadata==1.4.0
ipaddress==1.0.23
isort==4.3.21
itsdangerous==1.1.0
Jinja2==2.11.0
kafka==1.3.5
kombu==4.6.7
lazy-object-proxy==1.4.3
ldap3==2.6.1
libmfa==1.0.2
MarkupSafe==1.1.1
mccabe==0.6.1
mirakuru==2.1.2
more-itertools==8.2.0
netaddr==0.7.19
ntlm-auth==1.4.0
packaging==20.1
paramiko==2.7.1
pg8000==1.13.2
pgcli==2.2.0
pgspecial==1.11.9
pkg-resources==0.0.0
pluggy==0.13.1
port-for==0.4
prompt-toolkit==2.0.10
psutil==5.6.7
psycopg2==2.8.4
py==1.8.1
pyasn1==0.4.8
pycparser==2.19
Pygments==2.5.2
pylint==2.4.4
pylint-flask-sqlalchemy==0.2.0
PyNaCl==1.3.0
pyOpenSSL==19.1.0
pyparsing==2.4.6
pyproxy==1.0.0
pyrsistent==0.15.7
PySocks==1.7.1
pyTenable==1.0.5
pytest==5.3.5
pytest-postgresql==2.2.1
python-dateutil==2.8.1
pytz==2019.3
PyYAML==5.3
requests==2.22.0
requests-ntlm==1.1.0
scp==0.13.2
scramp==1.1.0
semver==2.9.0
setproctitle==1.1.10
six==1.13.0
SQLAlchemy==1.3.13
SQLAlchemy-Utils==0.36.1
sqlparse==0.3.0
tabulate==0.8.6
terminaltables==3.1.0
testing.common.database==2.0.3
testing.postgresql==1.3.0
toml==0.10.0
tox==3.14.3
typed-ast==1.4.1
tzlocal==2.0.0
urllib3==1.25.8
vine==1.3.0
virtualenv==16.7.9
wcwidth==0.1.8
Werkzeug==0.16.1
wrapt==1.11.2
xmltodict==0.12.0
zipp==2.1.0

Other Dependencies

rabbitmq.conf

ssl_options.cacertfile = /home/testca/ca_certificate.pem
ssl_options.certfile = /home/server/server_certificate.pem
ssl_options.keyfile = /home/server/private_key.pem
ssl_options.verify = verify_peer
ssl_options.fail_if_no_peer_cert = false
ssl_options.versions.1 = tlsv1.2
ssl_options.versions.2 = tlsv1.1
listeners.ssl.default = 5672
listeners.tcp = none
management.ssl.port = 15672
management.ssl.cacertfile = /home/testca/ca_certificate.pem
management.ssl.certfile = /home/server/server_certificate.pem
management.ssl.keyfile = /home/server/private_key.pem
management.ssl.verify = verify_peer
management.ssl.fail_if_no_peer_cert = false

celeryconfig.py

import os
import ssl

# pylint: disable=invalid-name
broker_use_ssl = {
# 'keyfile': '/tmp/certs/private_key.pem',
'keyfile': os.path.expanduser('~/certs/privates/home/server/private_key.pem'),
# 'keyfile': '/tmp/certs/privates/home/testca/private/ca_private_key.pem',
'certfile': os.path.expanduser('~/certs/privates/home/server/server_certificate.pem'),
'ca_certs': os.path.expanduser('~/certs/privates/home/testca/ca_certificate.pem'),
'cert_reqs': ssl.CERT_OPTIONAL,
'ssl_version': ssl.PROTOCOL_TLS
}
broker_url = os.environ.get('BROKER_URL', default="pyamqp://guest:guest@localhost:5672//")
result_backend = os.environ.get('RESULT_BACKEND_URL', default="rpc://guest:guest@localhost:5672//")

task_serializer = 'json'
result_serializer = 'json'
accept_content = ['json']
timezone = 'UTC'
enable_utc = True

imports = (
'*****************************',
)

task_annotations = {
'*******************************': {
'rate_limit': '6/h',
'serializer': 'json',
}
}

result_persistent = True

Minimally Reproducible Test Case

Expected Behavior

I would expect celery to be able to utilize TLSv1.2, so that a connection would be established between celery and rabbitmq over ssl

Actual Behavior

as you can see in the celery output; it is not attempting to communicate over TLS. Which means either the client or the server does not support TLSv1.2. As the default python protocol documentation states Selects the highest protocol version that both the client and server support. Despite the name, this option can select both “SSL” and “TLS” protocols.

So let's use openssl to checkout what our server supports

> openssl s_client -connect localhost:5672
...stuff you don't care about ...
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: E44641B94F8A8B6AF58CEC96A2C672C4736B24ACAC7FF690F52FFCC622A8E4B6
Session-ID-ctx:
Master-Key: FC57236B845D281943D0079D1EAFE5AA84A746B59D75787935D2E1921440CFB23C38DD3D21924A78551601CC4FB338B3
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1582652429
Timeout : 7200 (sec)
Verify return code: 19 (self signed certificate in certificate chain)
Extended master secret: no
---
closed

Rabbitmq is running with a TLS1.2 listener. So the server is not the issue during this communication. It must be the client.

In the related issue it was commented that

You can set the SSL version using broker_use_ssl using the ssl_version key if you are using SNI.

SSL3 shouldn't be the default.

setting ssl_version to ssl.PROTOCOL_TLS or even ssl.PROTOCOL_TLSv1_2 still results in SSLv3; so this is not a solution; even though your report says TLS version 2; that's not what is actually used.

Also on the linked issue:

However, the error goes away if I change the RabbitMQ config to: {fail_if_no_peer_cert, false}

This is no longer the case. I can hit the RabbitMQ web page with this set from my browser, however celery is still not able to contact the queue. Meaning my browser can communicate with RabbitMQ

Turning encryption off allows communication.

Please let me know if you need more information.