unbit / uwsgi

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

emperor, namespace and exit-on-reload #471

Closed prymitive closed 10 years ago

prymitive commented 10 years ago

I'm having issue that I can't figure out, I'm using emperor with chrooted apps (namespace option), there is no uWSGI installed inside the chroot, so I'm using exit-on-reload (tip found on mailing list). But I've noticed that (at least with my setup) it doesn't do full reload but rather respawn my vassal like it was daemon. After starting my vassal I can change any option in config file, it will reload, but all options are unchanged, like old ini file was used all the time.

After looking into it I've noticed that vassal master and worker(s) are reloading, but there is also another process spawned by emperor that do not reload:

before reload:

root      4195  0.0  0.1  73668  4012 ?        S    16:04   0:00 /usr/bin/uwsgi-core --ini 52a47ae602f22b0b30b0ead2.ini
www-data  4307  0.2  0.8 170532 17048 ?        Sl   16:18   0:00 [52a47ae602f22b0b30b0ead2 @ 52a47e2b02f22b0b3b647d0c] uWSGI master
www-data  4308  0.0  0.6  96800 14296 ?        S    16:18   0:00 [52a47ae602f22b0b30b0ead2 @ 52a47e2b02f22b0b3b647d0c] uWSGI worker 1

after reload:

root      4195  0.0  0.1  73668  4012 ?        S    16:04   0:00 /usr/bin/uwsgi-core --ini 52a47ae602f22b0b30b0ead2.ini
www-data  4319  7.5  0.8 170536 17048 ?        Sl   16:20   0:00 [52a47ae602f22b0b30b0ead2 @ 52a47e2b02f22b0b3b647d0c] uWSGI master
www-data  4320  0.0  0.6  96804 14292 ?        S    16:20   0:00 [52a47ae602f22b0b30b0ead2 @ 52a47e2b02f22b0b3b647d0c] uWSGI worker 1

On another node where I use chroot option, this process does not exist and reload works as expected.

Configs and logs are at https://gist.github.com/prymitive/d26a68b0aeb86ee71522

unbit commented 10 years ago

that process is the "init" one for the namespace: https://github.com/unbit/uwsgi/blob/master/lib/linux_ns.c#L60

I think the problem is here: https://github.com/unbit/uwsgi/blob/master/lib/linux_ns.c#L110 as when you add --exit-on-reload, uWSGI ends with 0, so the namespace "init" should deal with it