[uWSGI] UWSGI emperor mode issues when running with --daemonize2

Roberto De Ioris roberto at unbit.it
Mon Oct 21 11:53:27 CEST 2013


> Hi,
>
> I am trying to run UWSGI in emperor mode (for the first time in my life)
> and i am having some issues in getting the vassals to spawn when uwsgi is
> running with "--daemonize2". It works just fine with "--daemonize" but i
> would really rather use "--daemonize2" for reasons outside of the scope of
> this help request :)
>
> UWSGI version is 1.4.8
>
> My issue is that when UWSGI is started with --daemonize2 the uwsgi daemon
> does not spawn any vassal until i SIGTERM it, when I do then it seems to
> behave as expected, it finds the vassal and spawn the processes.
>
> for example:
> [root at mybox]# service uwsgi start
>
> [root at mybox]# ps auxww | grep uwsgi
>
> nobody   13075  0.0  0.0  19364   780 ?        S    10:36   0:00
> /usr/sbin/uwsgi --logto /var/log/uwsgi/error.log --daemonize2
> /var/log/uwsgi/error.log --logfile-chmod 644 --logfile-chown --pidfile2
> /var/run/uwsgi/uwsgi.pid --stats /var/run/uwsgi/uwsgi.stats --zerg-server
> /var/run/uwsgi/uwsgi.zerg --need-app --ini /etc/uwsgi/uwsgi.ini
> [root at mybox]#
>
> Then i SIGTERM it
>
> [root at mybox]# kill 13075
> [root at mybox]# ps auxww | grep uwsgi
> nobody   13075  0.0  0.0  18940  1480 ?        S    10:36   0:00
> /usr/sbin/uwsgi --logto /var/log/uwsgi/error.log --daemonize2
> /var/log/uwsgi/error.log --logfile-chmod 644 --logfile-chown --pidfile2
> /var/run/uwsgi/uwsgi.pid --stats /var/run/uwsgi/uwsgi.stats --zerg-server
> /var/run/uwsgi/uwsgi.zerg --need-app --ini /etc/uwsgi/uwsgi.ini
> nobody   13089  0.0  0.0  18768   684 ?        S    10:36   0:00
> /usr/sbin/uwsgi --logto /var/log/uwsgi/error.log --daemonize2
> /var/log/uwsgi/error.log --logfile-chmod 644 --logfile-chown --pidfile2
> /var/run/uwsgi/uwsgi.pid --stats /var/run/uwsgi/uwsgi.stats --zerg-server
> /var/run/uwsgi/uwsgi.zerg --need-app --ini /etc/uwsgi/uwsgi.ini
> nobody   13090  3.0  0.1  94456  5004 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13091  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13092  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13093  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13094  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13095  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13096  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13097  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13098  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13099  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
> nobody   13100  0.0  0.0  94456  2012 ?        S    10:36   0:00
> /usr/sbin/uwsgi --ini /etc/uwsgi/vassals/test.ini --inherit true
>
> logs shows :
>
> Mon Oct 21 11:06:05 2013 - *** starting uWSGI Emperor ***
> Mon Oct 21 11:06:05 2013 - detected max file descriptor number: 8192
> Mon Oct 21 11:06:05 2013 - lock engine: pthread robust mutexes
> Mon Oct 21 11:06:05 2013 - mapped 84712 bytes (82 KB) for 0 cores
> Mon Oct 21 11:06:05 2013 - *** Operational MODE: no-workers ***
> Mon Oct 21 11:06:05 2013 - gracefully (RE)spawned uWSGI master process
> (pid: 13075)
> Mon Oct 21 11:06:05 2013 - *** Zerg server enabled on
> /var/run/uwsgi/uwsgi.zerg ***
> Mon Oct 21 11:06:05 2013 - *** Stats server enabled on
> /var/run/uwsgi/uwsgi.stats fd: 7 ***
>
> and when I SIGTERM it
>
> *** has_emperor mode detected (fd: 5) ***
> [uWSGI] getting INI configuration from /etc/uwsgi/vassals/test.ini
> Mon Oct 21 11:08:23 2013 - [emperor] vassal /etc/uwsgi/vassals/test.ini is
> now loyal
> Mon Oct 21 11:08:23 2013 - [emperor] vassal /etc/uwsgi/vassals/test.ini is
> now loyal
>
> When i start it with just "--daemonize" this all happen at startup and
> everything works.
>
> Is there anything i can do (or i am doing wrong) to get it to work with
> "--daemonize2" ?
>
> Thanks
> Francesco
>
>


Hi, process managed by the Emperor cannot daemonize, when you specify
--daemonize under a vassal it is automatically disabled (this does not
happens for daemonize2):

http://uwsgi-docs.readthedocs.org/en/latest/Emperor.html#running-non-uwsgi-apps-or-using-alternative-uwsgis-as-vassals


-- 
Roberto De Ioris
http://unbit.it


More information about the uWSGI mailing list