unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.45k stars 691 forks source link

invalid reload with only daemons attached (no workers) #461

Closed prymitive closed 10 years ago

prymitive commented 10 years ago

I was lazy and instead of writing proper init script for my daemon I created vassal file for emperor, fortunately this paid off in finding a bug in uWSGI ;) With this simple config I can spawn uWSGI instance with daemon attached, but daemon won't get killed during shutdown despite attach-daemon usage:

[uwsgi]
master = true
touch-reload = /var/run/upaas_tasks.reload
attach-daemon = /usr/bin/upaas_admin builder_worker

If I would add socket and simple wsgi-file it gets killed. It seems that daemons are detached only if there is any socket/worker. I can't track why is this happening, can you take a look? It seems that uWSGI simply exits without bothering with daemon or other checks.

unbit commented 10 years ago

This is strange i have just tried spawning redis (a simple attach-daemon = redis-server) and worked normally.

Can you report the whole logs when you issue shutdown ?

Thanks a lot

prymitive commented 10 years ago

It looks like it was some other issue (probably on my side), when I tested it now my daemons are killed properly. Probably I was confused by the lack of any messages saying that it's reloading:

Sun Nov 17 18:30:02 2013 - [uwsgi-daemons] spawning "/usr/bin/upaas_admin builder_worker"
# touching reload file
Sun Nov 17 18:30:17 2013 - *** Starting uWSGI 1.9.20-debian (64bit) on [Sun Nov 17 18:30:17 2013] ***

When I removed vassal file it stopped properly and I got proper messages:

Sun Nov 17 18:34:21 2013 - received message 0 from emperor
Sun Nov 17 18:34:21 2013 - SIGINT/SIGQUIT received...killing workers...
Sun Nov 17 18:34:21 2013 - [uwsgi-daemons] stopping daemon (pid: 30016): /usr/bin/upaas_admin builder_worker
Sun Nov 17 18:34:23 2013 - goodbye to uWSGI.
prymitive commented 10 years ago

it turns out that this happens (daemons stay alive) when I'm stopping/restarting emperor process, my logs show only

Sat Dec 14 14:27:05 2013 - SIGINT/SIGQUIT received...killing workers...
Sat Dec 14 14:27:05 2013 - The Emperor has been buried (pid: 13650)
Sat Dec 14 14:27:05 2013 - goodbye to uWSGI.

vassal log doesn't have any messages when I stop emperor. This happens with basic emperor config:

[uwsgi]
log-date = true
emperor = /etc/uwsgi-emperor/vassals