我试图让 uWSGI 刷新它的工作人员,因为他们正在泄漏一些内存。但是,在重新加载工作人员后,它不再响应。我是不是忘记了什么?
uwsgi --http-socket 0.0.0.0:8000 --wsgi-file entry.py --processes 3 --master --req-logger file:/log/reqlog --logger file:/log/errlog --harakiri 15 --max-requests 3
max-requests 3 是测试重新加载:
mapped 291072 bytes (284 KB) for 3 cores
*** Operational MODE: preforking ***
2018-02-01 13:31:04,416 root [INFO] Starting
WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x17d9dc0 pid: 1 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 1)
spawned uWSGI worker 1 (pid: 11, cores: 1)
spawned uWSGI worker 2 (pid: 12, cores: 1)
spawned uWSGI worker 3 (pid: 13, cores: 1)
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
...The work of process 11 is done. Seeya!
flask@4078cdd3df37:/app$ curl localhost:8000
worker 1 killed successfully (pid: 11)
Respawned uWSGI worker 1 (new pid: 33)
{"message": "ok"}
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
...The work of process 13 is done. Seeya!
flask@4078cdd3df37:/app$ curl localhost:8000
{"message": "ok"}
...The work of process 12 is done. Seeya!
flask@4078cdd3df37:/app$ curl localhost:8000 --max-time 10
worker 3 killed successfully (pid: 13)
Respawned uWSGI worker 3 (new pid: 40)
worker 2 killed successfully (pid: 12)
Respawned uWSGI worker 2 (new pid: 43)
curl: (28) Operation timed out after 10001 milliseconds with 0 bytes received
flask@4078cdd3df37:/app$ curl localhost:8000 --max-time 10
curl: (28) Operation timed out after 10001 milliseconds with 0 bytes received
例如 uWSGI 不再响应(连接永远存在,除非我使用 curl --max-time)。uWSGI 内部如何通信?主进程如何知道如何联系工人?我认为那里出了点问题。