Search code examples
uwsgi

uWSGI Legion Subsystem Fails to Start Celery Beat


When attempting to use the Legion subsystem on Ubuntu 20.04 / Python 3.8.10 / uWSGI 2.0.20 (installed via pip), legion does not appear to start or run.

While attempting to follow the Celery Beat under legion example here I've hit a wall. As far as I can tell, the configuration should start a celery beat process but no process is started and no errors appear in the system journal. Right now I'm only trying to start the service on a single node in the cluster so there should be no conflicting Legion lords.

Configuration File:

[uwsgi]
module = wsgi:app

master = true
processes = 4

socket = middleware.sock
chmod-socket = 660
vacuum = true

die-on-term = true

enable-threads = true
need-app = true

legion-mcast = beatlegion 10.4.1.255:9191 90 bf-cbc:supersecretsharedkey
legion-smart-attach-daemon = beatlegion /var/run/celery/beat.pid celery beat --pidfile=/var/run/celery/beat.pid

Journal Output:

uwsgi[3540755]: spawned uWSGI worker 4 (pid: 3540783, cores: 1)
uwsgi[3540755]: spawned uWSGI worker 3 (pid: 3540782, cores: 1)
uwsgi[3540755]: spawned uWSGI worker 2 (pid: 3540781, cores: 1)
uwsgi[3540755]: spawned uWSGI worker 1 (pid: 3540780, cores: 1)
uwsgi[3540755]: spawned uWSGI master process (pid: 3540755)
uwsgi[3540755]: *** uWSGI is running in multiple interpreter mode ***
uwsgi[3540755]: WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x55f7177301e0 pid: 3540755 (default app)
uwsgi[3540755]: *** Operational MODE: preforking ***
uwsgi[3540755]: mapped 364520 bytes (355 KB) for 4 cores
uwsgi[3540755]: your mercy for graceful operations on workers is 60 seconds
uwsgi[3540755]: your server socket listen backlog is limited to 100 connections
uwsgi[3540755]: python threads support enabled
uwsgi[3540755]: Python main interpreter initialized at 0x55f7177301e0
uwsgi[3540755]: Python version: 3.8.10 (default, Mar 15 2022, 12:22:08)  [GCC 9.4.0]
uwsgi[3540755]: uwsgi socket 0 bound to UNIX address middleware.sock fd 3
uwsgi[3540755]: thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi[3540755]: lock engine: pthread robust mutexes
uwsgi[3540755]: detected max file descriptor number: 1024
uwsgi[3540755]: your memory page size is 4096 bytes
uwsgi[3540755]: your processes number limit is 127119
uwsgi[3540755]: detected binary path: /usr/local/bin/uwsgi
uwsgi[3540755]: current working directory: /data/middleware
uwsgi[3540755]: detected number of CPU cores: 8
uwsgi[3540755]: pcre jit disabled
uwsgi[3540755]: clock source: unix
uwsgi[3540755]: machine: x86_64
uwsgi[3540755]: os: Linux-5.4.0-110-generic #124-Ubuntu SMP Thu Apr 14 19:46:19 UTC 2022
uwsgi[3540755]: compiled with version: 9.4.0 on 17 June 2022 13:03:36
uwsgi[3540755]: *** Starting uWSGI 2.0.20 (64bit) on [Fri Jun 17 09:04:27 2022] ***
uwsgi[3540755]: [uWSGI] getting INI configuration from wsgi.ini

Solution

  • Turns out that Ubuntu 20.04 needs libssl-dev and uuid-dev installed for uWSGI to build the Legion subsystem. Issuing this solved the problem:

    sudo apt update; sudo apt install libssl-dev uuid-dev; pip uninstall uwsgi; pip install uwsgi --no-cache-dir