Skip to content

Sentinel with TLS not working #6455

Description

@AbdealiLoKo

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.
  • 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

Possible Duplicates

  • None

Environment & Settings

  • Celery: 5.0.0
  • Kombu: 5.0.2
  • Redis: 3.5.3
  • vine: 5.0.0
  • billiard: 3.6.3.0

Steps to Reproduce

Required Dependencies

  • Minimal Python Version: Python 3.6.5 :: Anaconda, Inc.
  • Minimal Celery Version: 5.0.0
  • Minimal Kombu Version: 5.0.2
  • Minimal Broker Version: Redis Server 6.0.8
  • Minimal Result Backend Version: Memory / Redis Server 6.0.8
  • Minimal OS and/or Kernel Version: CentOS 7
  • Minimal Broker Client Version: RedisPy 3.5.3
  • Minimal Result Backend Client Version: Memory / RedisPy 3.5.3

Other Dependencies

Needs SSL certificates for Redis TLS setup - I used https://github.com/michaelklishin/tls-gen to create them

Minimally Reproducible Test Case

I have the following configs:

redis_ssl = 
broker_connection_retry = False
broker_transport_options = broker_transport_options
# result_backend_transport_options = broker_transport_options
broker_use_ssl = {
  'ssl_keyfile': '/home/centos/redis/tls-gen/basic/result/client_key.pem',
  'ssl_certfile': '/home/centos/redis/tls-gen/basic/result/client_certificate.pem',
  'ssl_ca_certs': '/home/centos/redis/tls-gen/basic/result/ca_certificate.pem',
  'ssl_cert_reqs': 'required',
}
# redis_backend_use_ssl = redis_ssl

CELERY_BROKER_URL = 'sentinel://127.0.0.1:29876'
CELERY_RESULT_BACKEND = 'cache+memory://'  # Used only for testing - even with Redis here, it doesnt work

With redis.conf:

bind 0.0.0.0
protected-mode yes
port 0

tls-port 9875
tls-cert-file /home/centos/redis/tls-gen/basic/result/server_certificate.pem
tls-key-file /home/centos/redis/tls-gen/basic/result/server_key.pem
tls-ca-cert-file /home/centos/redis/tls-gen/basic/result/ca_certificate.pem
tls-replication yes

daemonize yes
pidfile /home/centos/redis/redis.pid
logfile /home/centos/redis/redis.log
dir /home/centos/redis

With redis-sentinel.conf:

port 29876
tls-port 29875
tls-cert-file "/home/centos/redis/tls-gen/basic/result/server_certificate.pem"
tls-key-file "/home/centos/redis/tls-gen/basic/result/server_key.pem"
tls-ca-cert-file "/home/centos/redis/tls-gen/basic/result/ca_certificate.pem"
tls-replication yes

daemonize yes
pidfile /home/centos/redis/sentinel.pid
logfile /home/centos/redis/sentinel.log
dir /home/centos/redis

sentinel monitor mymaster 127.0.0.1 9875 1
sentinel deny-scripts-reconfig yes
sentinel config-epoch mymaster 6

Expected Behavior

I was expecting Celery to be able to connect to Sentinel, fetch the host and port of the Master.
And then use TLS to connect to the Redis Master.

Actual Behavior

It gives an error TypeError: __init__() got an unexpected keyword argument 'connection_pool'
Traceback:

Details
 -------------- celery@ip v5.0.0 (singularity)
--- ***** -----
-- ******* ---- Linux-3.10.0-862.3.2.el7.x86_64-x86_64-with-centos-7.5.1804-Core 2020-11-02 14:00:50
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app:         corridor_api:0x7fce57b40860
- ** ---------- .> transport:   sentinel://IP:29876//
- ** ---------- .> results:     memory:///
- *** --- * --- .> concurrency: 1 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .> apilocal         exchange=apilocal(direct) key=apilocal
                .> celery           exchange=celery(direct) key=celery

[2020-11-02 14:00:50,595: CRITICAL/MainProcess] Unrecoverable error: TypeError("init() got an unexpected keyword argument 'connection_pool'",)
Traceback (most recent call last):
File "/opt/app/venv/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 918, in create_channel
return self._avail_channels.pop()
IndexError: pop from empty list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/app/venv/lib/python3.6/site-packages/redis/connection.py", line 1185, in get_connection
connection = self._available_connections.pop()
IndexError: pop from empty list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/app/venv/lib/python3.6/site-packages/celery/worker/worker.py", line 203, in start
self.blueprint.start(self)
File "/opt/app/venv/lib/python3.6/site-packages/celery/bootsteps.py", line 116, in start
step.start(parent)
File "/opt/app/venv/lib/python3.6/site-packages/celery/bootsteps.py", line 365, in start
return self.obj.start()
File "/opt/app/venv/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 311, in start
blueprint.start(self)
File "/opt/app/venv/lib/python3.6/site-packages/celery/bootsteps.py", line 116, in start
step.start(parent)
File "/opt/app/venv/lib/python3.6/site-packages/celery/worker/consumer/connection.py", line 21, in start
c.connection = c.connect()
File "/opt/app/venv/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 398, in connect
conn = self.connection_for_read(heartbeat=self.amqheartbeat)
File "/opt/app/venv/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 405, in connection_for_read
self.app.connection_for_read(heartbeat=heartbeat))
File "/opt/app/venv/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 427, in ensure_connected
conn.connect()
File "/opt/app/venv/lib/python3.6/site-packages/kombu/connection.py", line 277, in connect
max_retries=1, reraise_as_library_errors=False
File "/opt/app/venv/lib/python3.6/site-packages/kombu/connection.py", line 439, in _ensure_connection
callback, timeout=timeout
File "/opt/app/venv/lib/python3.6/site-packages/kombu/utils/functional.py", line 325, in retry_over_time
return fun(*args, **kwargs)
File "/opt/app/venv/lib/python3.6/site-packages/kombu/connection.py", line 866, in _connection_factory
self._connection = self._establish_connection()
File "/opt/app/venv/lib/python3.6/site-packages/kombu/connection.py", line 801, in _establish_connection
conn = self.transport.establish_connection()
File "/opt/app/venv/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 938, in establish_connection
self._avail_channels.append(self.create_channel(self))
File "/opt/app/venv/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 920, in create_channel
channel = self.Channel(connection)
File "/opt/app/venv/lib/python3.6/site-packages/kombu/transport/redis.py", line 526, in init
self.client.ping()
File "/opt/app/venv/lib/python3.6/site-packages/redis/client.py", line 1378, in ping
return self.execute_command('PING')
File "/opt/app/venv/lib/python3.6/site-packages/redis/client.py", line 898, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
File "/opt/app/venv/lib/python3.6/site-packages/redis/connection.py", line 1187, in get_connection
connection = self.make_connection()
File "/opt/app/venv/lib/python3.6/site-packages/redis/connection.py", line 1227, in make_connection
return self.connection_class(**self.connection_kwargs)
File "/opt/app/venv/lib/python3.6/site-packages/redis/connection.py", line 828, in init
super(SSLConnection, self).init(**kwargs)
TypeError: init() got an unexpected keyword argument 'connection_pool'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions