django – RabbitMQ + Celery. RabbitMQ creates new process every 60 seconds

My goal is to create task that sends notification email when user’s comment receives a reply. I’m using WSL Ubuntu, Django, Celery + RabbitMQ

The problem is every 60 second RabbitMQ creates new ‘/usr/lib/erlang/erts-10.6.4/bin/epmd -daemon’ process (hereinafter the PROCESS), without closing the previous one.

As shown in logs I started RabbitMQ server at 12:05, first PROCESS started at 12:05, after that RabbitMQ creates new PROCESS every minute.

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       338  0.0  0.0  16016  4420 tty1     S    12:05   0:00 sudo rabbitmq-server
root       339  0.0  0.0  10656  1928 tty1     S    12:05   0:00 /bin/sh /usr/sbin/rabbitmq-server
root       346  0.0  0.0  15116  2796 tty1     S    12:05   0:00 su rabbitmq -s /bin/sh -c /usr/lib/rabbitmq/bin/rabbitmq-server
rabbitmq   347  0.0  0.0  10656  1860 ?        Ss   12:05   0:00 sh -c /usr/lib/rabbitmq/bin/rabbitmq-server
rabbitmq   348  0.0  0.0  10656  1904 ?        S    12:05   0:00 /bin/sh /usr/lib/rabbitmq/bin/rabbitmq-server
rabbitmq   455  0.0  0.0  14400  2248 ?        S    12:05   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq   530  0.8  0.4 5345524 74892 ?       Sl   12:05   0:11 /usr/lib/erlang/erts-10.6.4/bin/beam.smp -W w -A 128 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -B i -- -ro
rabbitmq   575  0.0  0.0  14400  2212 ?        S    12:05   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq   706  0.0  0.0  10540  1664 ?        Ss   12:05   0:00 erl_child_setup 1024
rabbitmq   743  0.0  0.0  11928  1624 ?        Ss   12:05   0:00 inet_gethost 4
rabbitmq   744  0.0  0.0  12008  1840 ?        S    12:05   0:00 inet_gethost 4
root       745  0.0  0.0   9808  1100 tty3     Ss   12:05   0:00 /init
profile     746  0.0  0.0  15132  4084 tty3     S    12:05   0:00 -bash
rabbitmq   787  0.0  0.0  14400  2196 ?        S    12:06   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq   855  0.0  0.0  14400  2172 ?        S    12:07   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq   911  0.0  0.0  14400  2212 ?        S    12:08   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq   965  0.0  0.0  14400  2356 ?        S    12:09   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq  1024  0.0  0.0  14400  2264 ?        S    12:10   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq  1080  0.0  0.0  14400  2296 ?        S    12:11   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq  1134  0.0  0.0  14400  2264 ?        S    12:12   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq  1189  0.0  0.0  14400  2380 ?        S    12:13   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq  1245  0.0  0.0  14400  3504 ?        S    12:14   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq  1299  0.0  0.0  14400   252 ?        S    12:15   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon
rabbitmq  1353  0.0  0.0  14400   252 ?        S    12:16   0:00 /usr/lib/erlang/erts-10.6.4/bin/epmd -daemon

Steps to recreate the problem:

  1. install RabbitMQ: sudo apt-get install rabbitmq-server
  2. start RabbitMQ: sudo rabbitmq-server

No custom settings for RabbitMQ.

I tested 4 cases:

  1. Start RabbitMQ only
  2. Start RabbitMQ with Celery, project has no tasks
  3. Project has 1 task, no calls
  4. Projest has 1 task, call task manually every 30 seconds

Project settings.py:

CELERY_BROKER_URL = 'amqp://localhost'
CELERY_IGNORE_RESULT = True

In all cases, new PROCESS keeps appearing every minute.
I use ‘sudo rabbitmqctl stop’ to stop RabbitMQ server, but those proccesses are still opened after server shutdown.

According to RabbitMQ docs, RabbitMQ checks dead TCP connections every 60 seconds
www.rabbitmq.com/heartbeats.html

Checked /var/log/rabbitmq/rabbit@hostname.log file, last lines are:

2022-02-02 12:05:23.460 [info] <0.451.0> started TCP listener on 127.0.0.1:5672
2022-02-02 12:05:23.460 [info] <0.303.0> Running boot step cluster_name defined by app rabbit
2022-02-02 12:05:23.460 [info] <0.303.0> Running boot step direct_client defined by app rabbit
2022-02-02 12:05:23.460 [notice] <0.104.0> Changed loghwm of /var/log/rabbitmq/rabbit@Ksenia-Madi.log to 50
2022-02-02 12:05:23.680 [info] <0.8.0> Server startup complete; 0 plugins started.

No data after 12:05

Is it normal behaviour, shouldn’t rabbit close old connections or am I misundertanding the situation?

  • WSL Ubuntu 20.04.3 LTS
  • celery 5.2.3
  • RabbitMQ 3.8.2
  • Erlang 22.2.7

Read more here: Source link