flower icon indicating copy to clipboard operation
flower copied to clipboard

Rabbitmq broker API times out

Open Tomasz-Kluczkowski opened this issue 4 years ago • 44 comments

Describe the bug When using rabbitmq as the broker and specifying broker_api for Flower to use the request for api/queues times out with:

[E 210605 19:25:16 broker:78] RabbitMQ management API call failed: Timeout while connecting

Using identical url from the browser to reach the api/queues endpoint of rabbitmq management api is successful.

To Reproduce Steps to reproduce the behavior:

  1. Launch flower based on newest master with: celery -A tasks -broker=amqp://guest:guest@localhost:5672// flower --debug --broker_api=http://guest:guest@localhost:15672/api/
  2. Wait for flower to fully boot.
  3. Start rabbitmq and wait for it to fully boot.
  4. Go to localhost:5555
  5. Click on broker tab, notice the spinning browser's connection wheel
  6. Observe Flower's logs - eventually it will show the timeout error as above.

Similar situation happens if flower is started first and redis after.

Expected behavior The rabbitmq's api is responding correctly and Flower is able to use it.

Screenshots If applicable, add screenshots to help explain your problem.

System information Output of python -c 'from flower.utils import bugreport; print(bugreport())' command

flower   -> flower:1.0.1-dev tornado:6.1 humanize:3.3.0
software -> celery:5.0.5 (singularity) kombu:5.0.2 py:3.9.2
            billiard:3.6.3.0 py-amqp:5.0.5
platform -> system:Linux arch:64bit, ELF
            kernel version:5.4.0-70-generic imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:amqp results:disabled

deprecated_settings: None

Tomasz-Kluczkowski avatar Jun 05 '21 18:06 Tomasz-Kluczkowski

@mher I am looking into this one as it is I think the last remaining issue to fix and get new release so please assign me. Also it was reported here: https://stackoverflow.com/questions/66815640/how-can-i-connect-flower-to-the-broker-rabbitmq-in-docker-compose

Tomasz-Kluczkowski avatar Jun 05 '21 18:06 Tomasz-Kluczkowski

Results of investigation:

  • if rabbitmq (or broker in general) boots first (and is ready) and flower boots after, all is good (tested in docker-compose as well as launching rabbitmq/flower manually)
  • if flower boots first and we try to access broker tab, we get the timeout, unfortunately if we boot the rabbitmq now, even if it is fully booted flower will still fail to connect to it. Other tabs show no updated content (but no errors are logged when using them).

Tested if similar happens for Redis and it does although the broker tab does not result in spinning wheel of death and no Timeout is logged - still the dashboard, tasks tabs show no content and broker tab shows no real content.

Potential solutions:

  • find out if we can make Flower self-heal - have some mechanism of rebuilding the connection to broker?
  • how would this be done? It should be universal and one method somewhere called always as an attempt to retry.
  • do we have to check for connection to the broker to be present before making any calls? Probably not - just have a retry mechanism or make it a command line option?
  • for docker compose use wait-for-it script and start flower only after broker is ready (a copout really but what can one do)?
  • I will also fix a few bits in docker compose that are no longer valid (mainly using ENTRYPOINT ["flower"] as we can no longer do that in new version - have to use CMD as it can be fully overridden and ENTRYPOINT cannot).

@mher Can you point me at a place in the code where this issue takes place if you remember :)? Also when I boot Flower and there is no broker running, would you expect an exception being raised or an error logged in flower? Is there code that already checks that and stopped working?

Tomasz-Kluczkowski avatar Jun 05 '21 20:06 Tomasz-Kluczkowski

This is fixed in #1113 by making a connection check when booting.

Tomasz-Kluczkowski avatar Jun 20 '21 19:06 Tomasz-Kluczkowski

https://github.com/mher/flower/commit/d4ea1dcba6c42098fb5bb6e29bd82eeb8b6c2224 fixes the issue

mher avatar Jun 20 '21 20:06 mher

Thx @mher, I will test in our production if it all works nicely. I think then I will convert my #1113 to just docs and docker compose fix.

Tomasz-Kluczkowski avatar Jun 20 '21 20:06 Tomasz-Kluczkowski

Thanks @Tomasz-Kluczkowski , you can keep tests as well.

mher avatar Jun 20 '21 21:06 mher

I'm commenting just to say, as a fellow open source developer, that I'm impressed by you guys going so smoothly between two implementation variations - as well as contributing it on a Sunday.

So yeah, people are indeed watching (and loving) your work :)

petarmaric avatar Jun 20 '21 21:06 petarmaric

@mher I have tested your change (the added timeouts) and while yes, we no longer get the spinning wheel of death in the browser Flower still is no longer capable of connecting to the broker if it was booted without the broker running.

I have tested with rabbitmq and redis as brokers.

Test:

  • boot flower
  • go to localhost:5555
  • check tabs before broker started - no more super long timeouts for rabbitmq which is nice (redis never had this issue, but I checked it still does not have it :P).
  • boot broker and wait for it to fully boot
  • The broker tab seems to refresh for redis (shows the default celery queue)
  • The broker tab does not refresh for rabbitmq (all remains empty).
  • This is logged any time we try to access the broker tab in rabbitmq case (but the timeout now is 1s not forever :) ):
[E 210622 21:01:06 broker:79] RabbitMQ management API call failed: Timeout while connecting
[I 210622 21:01:07 web:2239] 304 GET /broker (::1) 1025.09ms
  • for both brokers the dashboard and tasks tab now show no content and never update.

If broker is started first and then Flower all is good.

I think we may need to merge my changes from #1113 with waiting for available broker as an improvement of sorts. In the end Celery itself does it and will not start if there is no broker. This is very important in kubernetes/docker deployment where we cannot guarantee order of booting of pods/containers to start Flower when the broker is working.

Please let me know what you think.

Tomasz-Kluczkowski avatar Jun 22 '21 20:06 Tomasz-Kluczkowski

I will check one more thing and report back.

Tomasz-Kluczkowski avatar Jun 22 '21 20:06 Tomasz-Kluczkowski

I tried and did not achieve anything @mher , I think making a check for broker connection on Flower's boot is the best option for now.

Please let me know if you want to merge it as it looks like I need to fix merge conflicts there.

Tomasz-Kluczkowski avatar Jun 22 '21 20:06 Tomasz-Kluczkowski

I'm not able to reproduce. Running without RabbitMQ, then starting, stoping RabbitMQ works as expected. Broker tab shows celery queue when RabbitMQ is available.

[D 210623 21:22:07 inspector:36] Sending stats inspect command
[D 210623 21:22:07 inspector:36] Sending active_queues inspect command
[D 210623 21:22:07 inspector:36] Sending registered inspect command
[D 210623 21:22:07 inspector:36] Sending scheduled inspect command
[D 210623 21:22:07 inspector:36] Sending active inspect command
[D 210623 21:22:07 inspector:36] Sending reserved inspect command
[D 210623 21:22:07 inspector:36] Sending revoked inspect command
[D 210623 21:22:07 inspector:36] Sending conf inspect command
[I 210623 21:22:14 web:2239] 304 GET /dashboard (::1) 42.40ms
[I 210623 21:22:15 web:2239] 200 GET /dashboard?json=1&_=1624497735046 (::1) 1.34ms
[I 210623 21:22:15 web:2239] 304 GET /tasks (::1) 18.24ms
[I 210623 21:22:16 web:2239] 200 POST /tasks/datatable (::1) 2.98ms
[E 210623 21:22:17 broker:79] RabbitMQ management API call failed: Timeout while connecting
[I 210623 21:22:17 web:2239] 200 GET /broker (::1) 1033.35ms
[D 210623 21:22:49 channel:104] using channel_id: 1
[D 210623 21:22:49 channel:444] Channel open
[D 210623 21:22:49 events:175] Capturing events...
[I 210623 21:22:49 mixins:226] Connected to amqp://guest:**@127.0.0.1:5672//
[D 210623 21:22:49 channel:104] using channel_id: 1
[D 210623 21:22:49 channel:444] Channel open
[D 210623 21:22:50 connection:726] heartbeat_tick : for connection fa534377364f4406a3347da30bb814dc
[D 210623 21:22:50 inspector:39] Inspect command reserved took 43.31s to complete
[W 210623 21:22:50 inspector:42] Inspect method reserved failed
[D 210623 21:22:50 inspector:39] Inspect command stats took 43.32s to complete
[W 210623 21:22:50 inspector:42] Inspect method stats failed
[D 210623 21:22:51 inspector:39] Inspect command active took 43.62s to complete
[W 210623 21:22:51 inspector:42] Inspect method active failed
[D 210623 21:22:51 inspector:39] Inspect command scheduled took 43.63s to complete
[D 210623 21:22:51 inspector:39] Inspect command revoked took 43.63s to complete
[W 210623 21:22:51 inspector:42] Inspect method scheduled failed
[D 210623 21:22:51 inspector:39] Inspect command conf took 43.62s to complete
[D 210623 21:22:51 inspector:39] Inspect command registered took 43.63s to complete
[W 210623 21:22:51 inspector:42] Inspect method revoked failed
[W 210623 21:22:51 inspector:42] Inspect method conf failed
[W 210623 21:22:51 inspector:42] Inspect method registered failed
[D 210623 21:22:51 inspector:39] Inspect command active_queues took 43.64s to complete
[W 210623 21:22:51 inspector:42] Inspect method active_queues failed
[D 210623 21:22:51 connection:726] heartbeat_tick : for connection fa534377364f4406a3347da30bb814dc
[I 210623 21:23:07 web:2239] 200 GET /broker (::1) 78.92ms
[D 210623 21:23:09 connection:726] heartbeat_tick : for connection fa534377364f4406a3347da30bb814dc
[I 210623 21:23:09 web:2239] 304 GET /tasks (::1) 20.86ms
[I 210623 21:23:09 web:2239] 200 POST /tasks/datatable (::1) 4.07ms
[I 210623 21:23:10 web:2239] 200 GET /dashboard (::1) 26.37ms
[I 210623 21:23:10 web:2239] 200 GET /dashboard?json=1&_=1624497790900 (::1) 0.59ms
[D 210623 21:23:11 connection:726] heartbeat_tick : for connection fa534377364f4406a3347da30bb814dc
[I 210623 21:23:11 web:2239] 304 GET /tasks (::1) 23.41ms
[I 210623 21:23:11 web:2239] 200 POST /tasks/datatable (::1) 1.80ms
[D 210623 21:23:12 connection:726] heartbeat_tick : for connection fa534377364f4406a3347da30bb814dc
[D 210623 21:23:13 connection:726] heartbeat_tick : for connection fa534377364f4406a3347da30bb814dc
\[D 210623 21:23:16 channel:147] Closed channel #1
[E 210623 21:23:16 events:184] Failed to capture events: '(0, 0): (320) CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'', trying again in 1 seconds.
[D 210623 21:23:16 events:187] (0, 0): (320) CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'
[E 210623 21:23:34 broker:79] RabbitMQ management API call failed: [Errno 61] Connection refused
[I 210623 21:23:34 web:2239] 200 GET /broker (::1) 50.91ms
[I 210623 21:23:35 web:2239] 304 GET /tasks (::1) 20.51ms
[I 210623 21:23:35 web:2239] 200 POST /tasks/datatable (::1) 2.62ms
[D 210623 21:24:05 channel:104] using channel_id: 1
[D 210623 21:24:05 channel:444] Channel open
[D 210623 21:24:15 connection:726] heartbeat_tick : for connection c17425d70afa424d87d4422f55308906
[D 210623 21:24:17 connection:726] heartbeat_tick : for connection c17425d70afa424d87d4422f55308906
[I 210623 21:24:23 web:2239] 200 GET /broker (::1) 61.83ms
[I 210623 21:24:24 web:2239] 304 GET /tasks (::1) 20.35ms
[I 210623 21:24:24 web:2239] 200 POST /tasks/datatable (::1) 4.48ms
[D 210623 21:24:25 connection:726] heartbeat_tick : for connection c17425d70afa424d87d4422f55308906

mher avatar Jun 24 '21 01:06 mher

I have to check if it makes the difference but my testing was done solely with rabbitmq/redis in docker containers.

This is to simulate closer to our production where it runs in a kubernetes pod.

Are you running rabbitmq for this test inside of a container too?

If not maybe that's the difference that makes or breaks Flower.

If that is the case I think a lot use cases are in containerised environments nowadays and Flower should cater to that too.

I will investigate more tomorrow evening.

Tomasz-Kluczkowski avatar Jun 25 '21 21:06 Tomasz-Kluczkowski

Are you running rabbitmq for this test inside of a container too?

Yes

mher avatar Jun 25 '21 22:06 mher

Hello, I just did extensive tests and still cannot make it connect to broker if rabbitmq in docker is started after Flower is finished booting up.

I tried initially using pycharm configuration to start the rabbitmq , then deleted the container/image and begun starting rabbitmq via command line with:

docker run --name rabbitmq -d -p 5762:5672 -p 15762:15762 -p 15672:15672 --network host rabbitmq

and I start flower not in a container which maybe is the reason for all of this trouble? I just start it via:

celery --broker=amqp://guest:guest@localhost:5672// flower --debug --broker_api=http://guest:guest@localhost:15672/api/

Are you running Flower in a docker container for this test too @mher?

Is the latest Flower image based on latest master so I can test too, or have to build it myself?

Tomasz-Kluczkowski avatar Jun 27 '21 14:06 Tomasz-Kluczkowski

Are you running Flower in a docker container for this test too @mher?

No, only RabbitMQ server. Flower is running from the master version with celery -A tasks flower --broker_api=http://guest:guest@localhost:15672/api/ --debug command

mher avatar Jun 27 '21 14:06 mher

Hopefully it has nothing to do with this (but I have seen issues with host OS making our own app work differently), but are you testing on Linux? I am using Linux on my laptop. Just trying to see where I make an error.

Tomasz-Kluczkowski avatar Jun 27 '21 14:06 Tomasz-Kluczkowski

I'm testing on OSX. Have you tried to use -A option instead of --broker?

mher avatar Jun 27 '21 14:06 mher

just did now, and I can see that then it used redis as the broker.

Tomasz-Kluczkowski avatar Jun 27 '21 14:06 Tomasz-Kluczkowski

I think because that is the celeryconfig.py inside flower/examples

Tomasz-Kluczkowski avatar Jun 27 '21 14:06 Tomasz-Kluczkowski

I am changing the celeryconfig.py to use rabbitmq as the broker_url and test again.

Tomasz-Kluczkowski avatar Jun 27 '21 14:06 Tomasz-Kluczkowski

You can change broker with env vars

CELERY_BROKER_URL=amqp://
CELERY_RESULT_BACKEND=rpc

mher avatar Jun 27 '21 14:06 mher

Ok , run with those env vars on both my linux machine and macbook pro with rabbitmq in docker and starting flower first and broker after creates the connection issue. I am really at a loss now what is the difference that makes it run for you @mher.

maybe it's the difference in how you start rabbitmq in docker?

Tomasz-Kluczkowski avatar Jun 27 '21 17:06 Tomasz-Kluczkowski

I attach the logs

[I 210627 18:50:56 web:2239] 200 GET /dashboard?json=1&_=1624816256363 (::1) 1.16ms
[E 210627 18:50:57 broker:79] RabbitMQ management API call failed: [Errno 111] Connection refused
[I 210627 18:50:57 web:2239] 200 GET /broker (::1) 42.44ms
[E 210627 18:51:00 broker:79] RabbitMQ management API call failed: [Errno 111] Connection refused
[I 210627 18:51:00 web:2239] 304 GET /broker (::1) 37.95ms
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 events:175] Capturing events...
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[I 210627 18:51:57 mixins:226] Connected to amqp://guest:**@127.0.0.1:5672//
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 channel:104] using channel_id: 1
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:51:57 channel:444] Channel open
[D 210627 18:52:02 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:52:02 channel:104] using channel_id: 1
[D 210627 18:52:02 channel:444] Channel open
[D 210627 18:52:07 connection:382] Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@XPS-15-9560', 'copyright': 'Copyright (c) 2007-2021 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.0.2', 'product': 'RabbitMQ', 'version': '3.8.17'}, mechanisms: [b'PLAIN', b'AMQPLAIN'], locales: ['en_US']
[D 210627 18:52:07 channel:104] using channel_id: 1
[D 210627 18:52:07 channel:444] Channel open
[I 210627 18:52:28 web:2239] 304 GET /dashboard (::1) 33.90ms
[I 210627 18:52:28 web:2239] 200 GET /dashboard?json=1&_=1624816348920 (::1) 0.57ms
[I 210627 18:52:29 web:2239] 200 GET /dashboard?json=1&_=1624816349925 (::1) 1.22ms
[I 210627 18:52:30 web:2239] 200 GET /dashboard?json=1&_=1624816350923 (::1) 0.99ms
[E 210627 18:52:31 broker:79] RabbitMQ management API call failed: Timeout while connecting
[I 210627 18:52:31 web:2239] 304 GET /broker (::1) 1039.64ms
[I 210627 18:52:43 web:2239] 304 GET /tasks (::1) 33.04ms
[I 210627 18:52:43 web:2239] 200 POST /tasks/datatable (::1) 1.95ms
[I 210627 18:52:53 web:2239] 304 GET /dashboard (::1) 34.19ms
[I 210627 18:52:53 web:2239] 200 GET /dashboard?json=1&_=1624816373178 (::1) 0.41ms
[I 210627 18:52:54 web:2239] 200 GET /dashboard?json=1&_=1624816374183 (::1) 1.35ms
[I 210627 18:52:55 web:2239] 200 GET /dashboard?json=1&_=1624816375181 (::1) 1.75ms
[I 210627 18:52:56 web:2239] 200 GET /dashboard?json=1&_=1624816376180 (::1) 0.54ms
[E 210627 18:52:56 broker:79] RabbitMQ management API call failed: Timeout while connecting
[I 210627 18:52:56 web:2239] 304 GET /broker (::1) 1041.77ms
[E 210627 18:53:15 broker:79] RabbitMQ management API call failed: Timeout while connecting
[I 210627 18:53:15 web:2239] 304 GET /broker (::1) 1035.79ms

Tomasz-Kluczkowski avatar Jun 27 '21 17:06 Tomasz-Kluczkowski

You can see before I start rabbitmq in docker, it says:

[E 210627 18:51:00 broker:79] RabbitMQ management API call failed: [Errno 111] Connection refused

Then I start rabbitmq and we get:

[I 210627 18:51:57 mixins:226] Connected to amqp://guest:**@127.0.0.1:5672//

but then I go to the broker tab and still we get:

[E 210627 18:52:31 broker:79] RabbitMQ management API call failed: Timeout while connecting
[I 210627 18:52:31 web:2239] 304 GET /broker (::1) 1039.64ms

:(

Tomasz-Kluczkowski avatar Jun 27 '21 18:06 Tomasz-Kluczkowski

The difference I see is that in your logs above after it connected it did all those inspect calls again:

[D 210623 21:22:50 connection:726] heartbeat_tick : for connection fa534377364f4406a3347da30bb814dc
[D 210623 21:22:50 inspector:39] Inspect command reserved took 43.31s to complete
[W 210623 21:22:50 inspector:42] Inspect method reserved failed
[D 210623 21:22:50 inspector:39] Inspect command stats took 43.32s to complete
[W 210623 21:22:50 inspector:42] Inspect method stats failed
[D 210623 21:22:51 inspector:39] Inspect command active took 43.62s to complete
[W 210623 21:22:51 inspector:42] Inspect method active failed
[D 210623 21:22:51 inspector:39] Inspect command scheduled took 43.63s to complete
[D 210623 21:22:51 inspector:39] Inspect command revoked took 43.63s to complete
[W 210623 21:22:51 inspector:42] Inspect method scheduled failed
[D 210623 21:22:51 inspector:39] Inspect command conf took 43.62s to complete
[D 210623 21:22:51 inspector:39] Inspect command registered took 43.63s to complete
[W 210623 21:22:51 inspector:42] Inspect method revoked failed
[W 210623 21:22:51 inspector:42] Inspect method conf failed
[W 210623 21:22:51 inspector:42] Inspect method registered failed
[D 210623 21:22:51 inspector:39] Inspect command active_queues took 43.64s to complete
[W 210623 21:22:51 inspector:42] Inspect method active_queues failed

I do not see that in my logs after it connected, but not sure if this makes any difference

Tomasz-Kluczkowski avatar Jun 27 '21 18:06 Tomasz-Kluczkowski

are you running latest rabbitmq docker image @mher?

my command for local testing (I use --network host to have access to the api in the browser)

docker run --name rabbitmq -d -p 5762:5672 -p 15762:15762 --network host rabbitmq

is this how you run yours?

Tomasz-Kluczkowski avatar Jun 27 '21 18:06 Tomasz-Kluczkowski

Try to reproduce using this docker-compose

version: "3.9"
services:
    rabbitmq:
        image: rabbitmq:3-management
        ports:
          - 5672:5672
          - 15672:15672
    flower:
        image: mher/flower
        command: --broker=amqp://rabbitmq --broker_api=http://guest:guest@rabbitmq:15672/api/
        ports:
            - 5555:5555
  1. docker-compose up
  2. docker-compose stop rabbitmq
  3. open http://localhost:5555/broker
  4. docker-compose start rabbitmq
  5. open http://localhost:5555/broker

mher avatar Jun 27 '21 18:06 mher

I think this is the reason why it may be working for you. If you start via docker compose then both rabbitmq and flower start at more or less same time. For me that usually results in correct boot, but once in say 10-15 boots flower will boot too early (before rabbitmq is ready to accept connections) and then the broker tab never works.

Are you testing as I mention below?

What we need to test is strictly manually start flower, wait for it to finish boot, then manually start rabbitmq in docker - for me on both linux and mac it then never connects to broker and shows timeout error.

point number 2 regarding this docker compose - it uses old flower image / celery 4.4.7 (I exec'd into it):

/usr/local/bin $ flower --version
0.9.7
4.4.7 (cliffs)

Could you try the manual starting and then see if it fails for you same way as for me please? If you already did then I have no more ideas for now grrrr :(/

Tomasz-Kluczkowski avatar Jun 27 '21 18:06 Tomasz-Kluczkowski

I stop both rabbitmq and flower then start flower

» docker-compose stop rabbitmq flower                                                                              
Stopping flower-docker_flower_1   ... done
Stopping flower-docker_rabbitmq_1 ... done
» docker-compose start flower                                                                                       
Starting flower ... done
...
» docker-compose start rabbitmq                                                                                     
Starting rabbitmq ... done
flower_1    | [E 210627 19:04:49 broker:78] RabbitMQ management API call failed: Timeout while connecting
flower_1    | [I 210627 19:05:29 mixins:229] Connected to amqp://guest:**@rabbitmq:5672//```

mher avatar Jun 27 '21 19:06 mher

Ok but it runs incorrect flower version with old celery. I guess we need to be strict here and use actual newest versions.

I will create a new publicly available image of flower based on its newest master and then we can do all these tests using docker-compose with it.

Still if you could be so kind and try just manual starting of newest master of flower from command line and then manual start of rabbitmq inside docker, maybe the issue would appear as well…

Tomasz-Kluczkowski avatar Jun 27 '21 19:06 Tomasz-Kluczkowski