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

fc lists fclists at pr-z.info
Mon Oct 21 11:50:46 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


here is the uwsgi.ini and my test.ini adn test.psgi vassal:
-----------------------------------
/etc/uwsgi/uwsgi.ini
[uwsgi]
uid = nobody
gid = nobody
emperor = /etc/uwsgi/vassals/*.ini
chmod-socket = 660
master = true
vassals-inherit = true
processes = 10
listen = 2048
logdate = true
disable-logging = true
ignore-sigpipe = true
ignore-write-errors = true
buffer-size = 16384
perl-no-die-catch = true
-----------------------------------
/etc/uwsgi/vassals/test.ini
[uwsgi]
master = true
processes = 10
socket = /var/run/uwsgi/test.sock
psgi = /tmp/test/test.psgi
logto = /var/log/uwsgi/test.log
chmod-socket = 660
-----------------------------------
/tmp/test/test.psgi
#!/usr/bin/perl

use strict;
use warnings;

my $app = sub {
     my $env = shift;
     return [
             '200',
             [ 'Content-Type' => 'text/html' ],
             [ "<h1>Hello World</h1>" ],
     ];
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20131021/86cd6be6/attachment.html>


More information about the uWSGI mailing list