Search code examples
uwsgiupstart

Upstart spawn multiple uWSGI Emperor processes


When uWSGI start via Upstart I have independent Emperor instances whith two process each (as manually run, see below).

Upstart create multiple emperor processes:

# ps ax | grep -i emper                                                                                                                       
  888 ?        S      0:53 uwsgi /etc/uwsgi/emperor.ini
  896 ?        S      0:33 uwsgi /etc/uwsgi/emperor.ini
  904 ?        S      0:52 uwsgi /etc/uwsgi/emperor.ini
  905 ?        S      0:34 uwsgi /etc/uwsgi/emperor.ini
  ...

When I kill all Emperors and run it manually I have two Emperor's processes with workers for sites:

# pstree -up | less
  ...
  -uwsgi(16347)---uwsgi(16348)-+-uwsgi(16349,web)-+-uwsgi(16358)
    |                             |                  |-uwsgi(16360)
    |                             |                  |-uwsgi(17058)
    |                             |                  |-uwsgi(17261)
    |                             |                  |-uwsgi(17410)
    |                             |                  |-uwsgi(17488)
    |                             |                  |-uwsgi(17750)
    |                             |                  `-uwsgi(17770)
    |                             `-uwsgi(16350,web)-+-uwsgi(16361)
    |                                                |-uwsgi(16362)
    |                                                |-uwsgi(16363)
    |                                                |-uwsgi(16364)
    |                                                |-uwsgi(16365)
    |                                                |-uwsgi(16366)
    |                                                |-uwsgi(16367)
    |                                                `-uwsgi(16368)

My Upstart config for Emperor:

# Emperor uWSGI script

description "uWSGI Emperor"
start on runlevel [2345]
stop on runlevel [06]

respawn

exec uwsgi /etc/uwsgi/emperor.ini

My uWSGI Emperor config:

[uwsgi]
  emperor-tyrant = true
  emperor = %dvassals
  emperor-pidfile = %demperor.pid
  emperor-stats = %demperor.stat.sock
  vassals-include = %dvassals-default.ini
  touch-logrotate = %p
  touch-reload = %p
  touch-reload = %dvassals-default.ini
  log-date = true
  log-truncate = true
  daemonize = /var/log/uwsgi/emperor.log

May be I wrong on Upstart config? Logs didn't help me.


Solution

  • Need change daemonize to logto.

    More info in issue in uWSGI repo: https://github.com/unbit/uwsgi/issues/1510