Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when master flag is set to false uwsgi is does not kill all workers #851

Closed
raigad opened this issue Feb 23, 2015 · 4 comments
Closed

when master flag is set to false uwsgi is does not kill all workers #851

raigad opened this issue Feb 23, 2015 · 4 comments

Comments

@raigad
Copy link

raigad commented Feb 23, 2015

Hi ,

master=false
processes=4

When master flag is set to false and processes set to more than 1 then when you try to stop the uwsgi server using command

/etc/init.d/uwsgi stop 

above command does not kill all the workers/processes. It only kills one worker/proceses and rest of the processes are running so uwsgi is serving requests. You can check the running processes using command

ps -ef  | grep uwsgi 

and also when I run following command it says that uwsgi is stopped but actually that is not the case

/etc/init.d/uwsgi status 

thanks
Regards
Rohit

@xrmx
Copy link
Collaborator

xrmx commented Feb 23, 2015

@raigad which distribution? the init scripts are usually distro specific, what is the stop function doing?

@raigad
Copy link
Author

raigad commented Feb 23, 2015

I am using CentOS release 6.5 (Final) and uwsgi-2.0.8
I also noticed that in init.d script the params such as UWSGI_LOG_DIR, UWSGI_ARGS and PIDFILE_DIR are hardcoded, which might cause issues if we want to use custom directories for them

@raigad
Copy link
Author

raigad commented Feb 23, 2015

stop() {
    config_file="$1"
    instance=$(instance_for "$config_file")
    pidfile=$(pidfile_for "$config_file")

    echo -n "Stopping uWSGI for ${instance}... "
    killproc -p "$pidfile" "$prog"
    retval=$?
    echo
    return $retval
}

here is what stop() doing. I think if procesess dont have common master as parent then only one process/worker is killed and rest of them remain intact.

@anthonyrisinger
Copy link
Contributor

This isn't really a bug in uWSGI... probably the first process is writing its own pid to pidfile (worker 1 assumes some of the masters duties when master is unavailable).

What do you expect to happen exactly? For such a setup, using --master is the only thing that makes sense, and is a Good Thing regardless.

Pidfiles are well known to be unreliable for process management; use --master or a real babysitter like systemd.

@xrmx xrmx closed this as completed Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants