Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill all instance of uwsgi

I am trying to upload my project to the server. There is already a project in the server now. I have new project which I want to run and replace the old project with the new one, so I pull the new project to the server. Then I activate the virtual environment and do all the necessary work. Then when I try to run the command:

uwsgi --plugins=python --chdir=/var/www/prjt/src/ --socket=127.0.0.1:8889 --module=prjt.wsgi:application &

it tell me that

probably another instance of uWSGI is running on the same address (127.0.0.1:8889).
bind(): Address already in use [core/socket.c line 761]

I searched for similar problems and found some solutions about killing all instance of uwsgi as mentioned in this answer here but could not find how to do it.

like image 302
user2413621 Avatar asked Aug 12 '15 16:08

user2413621


People also ask

How do I reset my uWSGI server?

If you change uwsgi systemd service file, reload the daemon and restart the process by typing: sudo systemctl daemon-reload. sudo systemctl restart uwsgi.

How many processes does uWSGI have?

ini configuration file. The threads option is used to tell uWSGI to start our application in prethreaded mode. That essentially means it is launching the application across multiple threads, making our four processes essentially eight processes.

What is lazy apps in uWSGI?

Remember: lazy-apps is different from lazy, the first one only instructs uWSGI to load the application one time per worker, while the second is more invasive (and generally discouraged) as it changes a lot of internal defaults.


2 Answers

for me the way to kill uwsgi instances in a bruteforce manner was:

sudo pkill -f uwsgi -9
like image 155
andilabs Avatar answered Sep 28 '22 01:09

andilabs


Add a pidfile to your command:

uwsgi --plugins=python --chdir=/var/www/prjt/src/ --socket=127.0.0.1:8889 --module=prjt.wsgi:application --pidfile /tmp/myapp.pid

Then use

uwsgi --stop /tmp/myapp.pid

to stop the uwsgi instance in a safe way.

If you didn't specify a pidfile when you started the first instance, you can kill it brutally using

kill `pidof uwsgi`
like image 43
John Smith Optional Avatar answered Sep 28 '22 03:09

John Smith Optional