我正在使用uwsgi
+ django
+ nginx
,但是出现了一些僵尸进程([uwsgi] <defunct>
)。
1 uwsgi.ini
[uwsgi]
pythonpath=/pythonpath
chdir=/chdir
env=DJANGO_SETTINGS_MODULE=conf.settings
module=my.wsgi
master=True
pidfile=logs/server.pid
vacuum=True
max-requests=100000
enable-threads=true
processes = 16
threads=32
listen=1024
daemonize=logs/wsgi.log
log-slow=3000
http=0.0.0.0:8087
当我启动uwsgi时,它显示如下:
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14821)
spawned uWSGI worker 1 (pid: 14832, cores: 32)
spawned uWSGI worker 2 (pid: 14833, cores: 32)
spawned uWSGI worker 3 (pid: 14834, cores: 32)
spawned uWSGI worker 4 (pid: 14841, cores: 32)
spawned uWSGI worker 5 (pid: 14851, cores: 32)
spawned uWSGI worker 6 (pid: 14862, cores: 32)
spawned uWSGI worker 7 (pid: 14876, cores: 32)
spawned uWSGI worker 8 (pid: 14887, cores: 32)
spawned uWSGI worker 9 (pid: 14903, cores: 32)
spawned uWSGI worker 10 (pid: 14920, cores: 32)
spawned uWSGI worker 11 (pid: 14940, cores: 32)
spawned uWSGI worker 12 (pid: 14964, cores: 32)
spawned uWSGI worker 13 (pid: 14983, cores: 32)
spawned uWSGI worker 14 (pid: 15008, cores: 32)
spawned uWSGI worker 15 (pid: 15031, cores: 32)
spawned uWSGI worker 16 (pid: 15053, cores: 32)
一段时间后,出现了僵尸进程,所有这些进程都是从pid 14862
分叉的。
ps -ef | grep defunct
user 25116 14862 0 Dec18 ? 00:00:00 [uwsgi] <defunct>
user 25117 14862 0 Dec18 ? 00:00:00 [uwsgi] <defunct>
user 25118 14862 0 Dec18 ? 00:00:00 [uwsgi] <defunct>
user 25119 14862 0 Dec18 ? 00:00:00 [uwsgi] <defunct>
如何避免这些僵尸进程?