[pkg-uWSGI-devel] Bug#799971: Failing to gracefully stop worker processes

PF4Public PF4Public at mail.ru
Thu Sep 24 20:22:52 UTC 2015


Package: uwsgi-emperor
Version: 2.0.7-1
Severity: important

When using initscript to stop or restart uwsgi-emperor expected behaviour is that emperor 
along with all its vassals cleanly shuts down, however this is not the case with current 
package version.

That is, instead of cleanly shutting down, it brutally restarts, but after some timeout 
initscript forces restarted emperor to die.

Emperor log:
Thu Sep 24 22:08:28 2015 - [emperor] vassal v.ini is ready to accept requests
Thu Sep 24 22:12:28 2015 - waiting for Emperor death...
Thu Sep 24 22:12:28 2015 - [emperor] *** RAGNAROK EVOKED ***
Thu Sep 24 22:12:28 2015 - [emperor] stop the uwsgi instance v.ini
Thu Sep 24 22:12:29 2015 - waiting for Emperor death...
Thu Sep 24 22:12:30 2015 - waiting for Emperor death...
Thu Sep 24 22:12:30 2015 - [emperor] removed uwsgi instance v.ini
Thu Sep 24 22:12:31 2015 - waiting for Emperor death...
Thu Sep 24 22:12:31 2015 - The Emperor is buried.
Thu Sep 24 22:12:32 2015 - The Emperor has been buried (pid: 4150)
Thu Sep 24 22:12:32 2015 - ...brutally killing workers...
Thu Sep 24 22:12:32 2015 - binary reloading uWSGI...
Thu Sep 24 22:12:32 2015 - chdir() to /
Thu Sep 24 22:12:32 2015 - closing all non-uwsgi socket fds > 2 (max_fd = 1024)...
Thu Sep 24 22:12:32 2015 - running /usr/bin/uwsgi-core
[uWSGI] getting INI configuration from /etc/uwsgi-emperor/emperor.ini
Thu Sep 24 22:12:32 2015 - *** Starting uWSGI 2.0.10-debian (32bit) on [Thu Sep 24 
22:12:32 2015] ***

And the vassal log:
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 4152)
spawned uWSGI worker 1 (pid: 4168, cores: 1)
spawned uWSGI worker 2 (pid: 4169, cores: 1)
spawned uWSGI worker 3 (pid: 4170, cores: 1)
spawned uWSGI worker 4 (pid: 4171, cores: 1)
spawned uWSGI worker 5 (pid: 4172, cores: 1)
spawned uWSGI worker 6 (pid: 4173, cores: 1)
spawned uWSGI worker 7 (pid: 4174, cores: 1)
spawned uWSGI worker 8 (pid: 4175, cores: 1)
Thu Sep 24 22:12:28 2015 - received message 0 from emperor
SIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
worker 3 buried after 1 seconds
worker 4 buried after 1 seconds
worker 5 buried after 1 seconds
worker 6 buried after 1 seconds
worker 7 buried after 1 seconds
worker 8 buried after 1 seconds
goodbye to uWSGI.
VACUUM: unix socket /var/......... removed.
*** Starting uWSGI 2.0.10-debian (32bit) on [Thu Sep 24 22:12:32 2015] ***
...
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 5188)
spawned uWSGI worker 1 (pid: 5189, cores: 1)
spawned uWSGI worker 2 (pid: 5190, cores: 1)
spawned uWSGI worker 3 (pid: 5191, cores: 1)
spawned uWSGI worker 4 (pid: 5192, cores: 1)
spawned uWSGI worker 5 (pid: 5193, cores: 1)
spawned uWSGI worker 6 (pid: 5194, cores: 1)
spawned uWSGI worker 7 (pid: 5195, cores: 1)
spawned uWSGI worker 8 (pid: 5196, cores: 1)
Thu Sep 24 22:12:58 2015 - uWSGI worker 4 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!
Thu Sep 24 22:12:58 2015 - uWSGI worker 2 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!
Thu Sep 24 22:12:58 2015 - uWSGI worker 6 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!
Thu Sep 24 22:12:58 2015 - uWSGI worker 3 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!
Thu Sep 24 22:12:58 2015 - uWSGI worker 7 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!
Thu Sep 24 22:12:58 2015 - uWSGI worker 1 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!
Thu Sep 24 22:12:58 2015 - uWSGI worker 5 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!
Thu Sep 24 22:12:58 2015 - uWSGI worker 8 screams: UAAAAAAH my master disconnected: i will 
kill myself !!!

Some googling suggests that it has something to do with SIGTERM, which is used by 
initscript to stop emperor, however according to 
http://uwsgi-docs.readthedocs.org/en/latest/Management.html, it brutally reloads workers. 
And it is stated that this is intended behaviour untill version 2.1 here: 
http://uwsgi-docs.readthedocs.org/en/latest/ThingsToKnow.html

Simplest solution is to add by default "die-on-term" to /etc/uwsgi-emperor/emperor.ini 
till version 2.1 is available



More information about the pkg-uWSGI-devel mailing list