2

I'm trying to execute a longer task with celery, so to test I made a sample task sleep for 5 minutes and set the rabbitmq.conf file with a single line containing consumer_timeout = 10000 expecting the task to fail with precondition error after 10seconds(or at least after 60 seconds as per this answer), but it never did. The task completes after 5mins. I can see the rabbitmq.conf file shows up on top of logs(which I think it means it loaded the file successfully??)

main_rabbitmq         |   Config file(s): /etc/rabbitmq/rabbitmq.conf
main_rabbitmq         |                   /etc/rabbitmq/conf.d/10-default-guest-user.conf

My Dockerfile:

FROM rabbitmq:3.9.13-management

# Define environment variables.
ENV RABBITMQ_USER user
ENV RABBITMQ_PASSWORD password
ENV RABBITMQ_PID_FILE /var/lib/rabbitmq/mnesia/rabbitmq

COPY ./myrabbit.conf /etc/rabbitmq/rabbitmq.conf

ADD init.sh /init.sh
RUN chmod +x /init.sh

# Define default command
CMD ["/init.sh"]

The init.sh file is similar to this.

Vijayabhaskar J
  • 417
  • 2
  • 4
  • 17
  • Just a guess: `consumer_timeout` may exist in both config files and your value is overriding by default `/etc/rabbitmq/conf.d/10-default-guest-user.conf` value – rzlvmp May 20 '22 at 11:42
  • I checked it, it has only one line `loopback_users.guest = false` – Vijayabhaskar J May 20 '22 at 11:47

1 Answers1

0

Please see this repository which you can use to see the consumer timeout happen:

https://github.com/lukebakken/stackoverflow-72318314-1466825

Note that I made some improvements to your custom entrypoint script.

I do see that the consumer_timeout setting is applied correctly. However, there is another setting that comes into play, the channel_tick_timeout which is the interval at which periodic operations happen on a channel (like checking for stale consumers). This is set to 60 seconds by default.

https://stackoverflow.com/a/70958499/1466825

Without knowing how you use Celery I can't say why you're not seeing the same timeout.


NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Luke Bakken
  • 8,993
  • 2
  • 20
  • 33