Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'ChannelPromise' object has no attribute '__value__' #369

Open
zN3utr4l opened this issue Jun 8, 2023 · 1 comment
Open

Comments

@zN3utr4l
Copy link

zN3utr4l commented Jun 8, 2023

i have updated kombu and celery to the latest version 5.3.0 from that moment even if i downgrade to the first one the error still pops up

unavailable: Unknown error
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 472, in _reraise_as_library_errors
    yield
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection
    return retry_over_time(
  File "/opt/conda/lib/python3.9/site-packages/kombu/utils/functional.py", line 318, in retry_over_time
    return fun(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 941, in _connection_factory
    self._connection = self._establish_connection()
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 867, in _establish_connection
    conn = self.transport.establish_connection()
  File "/opt/conda/lib/python3.9/site-packages/kombu/transport/pyamqp.py", line 203, in establish_connection
    conn.connect()
  File "/opt/conda/lib/python3.9/site-packages/amqp/connection.py", line 323, in connect
    self.transport.connect()
  File "/opt/conda/lib/python3.9/site-packages/amqp/transport.py", line 129, in connect
    self._connect(self.host, self.port, self.connect_timeout)
  File "/opt/conda/lib/python3.9/site-packages/amqp/transport.py", line 184, in _connect
    self.sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/health_check/contrib/celery_ping/backends.py", line 15, in check_status
    ping_result = app.control.ping(timeout=timeout)
  File "/opt/conda/lib/python3.9/site-packages/celery/app/control.py", line 563, in ping
    return self.broadcast(
  File "/opt/conda/lib/python3.9/site-packages/celery/app/control.py", line 776, in broadcast
    return self.mailbox(conn)._broadcast(
  File "/opt/conda/lib/python3.9/site-packages/kombu/pidbox.py", line 330, in _broadcast
    chan = channel or self.connection.default_channel
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 960, in default_channel
    self._ensure_connection(**conn_opts)
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection
    return retry_over_time(
  File "/opt/conda/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 476, in _reraise_as_library_errors
    raise ConnectionError(str(exc)) from exc
kombu.exceptions.OperationalError: [Errno 111] Connection refused
unavailable: Unknown error
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/kombu/utils/functional.py", line 32, in __call__
    return self.__value__
AttributeError: 'ChannelPromise' object has no attribute '__value__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 472, in _reraise_as_library_errors
    yield
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection
    return retry_over_time(
  File "/opt/conda/lib/python3.9/site-packages/kombu/utils/functional.py", line 318, in retry_over_time
    return fun(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 941, in _connection_factory
    self._connection = self._establish_connection()
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 867, in _establish_connection
    conn = self.transport.establish_connection()
  File "/opt/conda/lib/python3.9/site-packages/kombu/transport/pyamqp.py", line 203, in establish_connection
    conn.connect()
  File "/opt/conda/lib/python3.9/site-packages/amqp/connection.py", line 323, in connect
    self.transport.connect()
  File "/opt/conda/lib/python3.9/site-packages/amqp/transport.py", line 129, in connect
    self._connect(self.host, self.port, self.connect_timeout)
  File "/opt/conda/lib/python3.9/site-packages/amqp/transport.py", line 184, in _connect
    self.sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/health_check/contrib/celery/backends.py", line 17, in check_status
    result = add.apply_async(
  File "/opt/conda/lib/python3.9/site-packages/celery/app/task.py", line 594, in apply_async
    return app.send_task(
  File "/opt/conda/lib/python3.9/site-packages/celery/app/base.py", line 798, in send_task
    amqp.send_task_message(P, name, message, **options)
  File "/opt/conda/lib/python3.9/site-packages/celery/app/amqp.py", line 517, in send_task_message
    ret = producer.publish(
  File "/opt/conda/lib/python3.9/site-packages/kombu/messaging.py", line 186, in publish
    return _publish(
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 563, in _ensured
    return fun(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/kombu/messaging.py", line 195, in _publish
    channel = self.channel
  File "/opt/conda/lib/python3.9/site-packages/kombu/messaging.py", line 218, in _get_channel
    channel = self._channel = channel()
  File "/opt/conda/lib/python3.9/site-packages/kombu/utils/functional.py", line 34, in __call__
    value = self.__value__ = self.__contract__()
  File "/opt/conda/lib/python3.9/site-packages/kombu/messaging.py", line 234, in <lambda>
    channel = ChannelPromise(lambda: connection.default_channel)
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 960, in default_channel
    self._ensure_connection(**conn_opts)
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 459, in _ensure_connection
    return retry_over_time(
  File "/opt/conda/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/conda/lib/python3.9/site-packages/kombu/connection.py", line 476, in _reraise_as_library_errors
    raise ConnectionError(str(exc)) from exc
kombu.exceptions.OperationalError: [Errno 111] Connection refused
@zN3utr4l
Copy link
Author

The problem is this: docker-library/rabbitmq#645
django-health-check is tryng to connect to celery rabbitmq queue via 127.0.0.1, but im on docker and I need to update the connection string, it should not point to 127.0.0.1:5672, it should be rabbitmq:5672. keep in mind localhost in container mean this container, not rabbitmq container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant