我试图让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如何在内部进行通信?主过程如何知道如何联系工人?我觉得那里出了点问题。
答案 0 :(得分:0)
我遇到了同样的问题。似乎未设置主标志时,此问题就消失了。对于那些使用皇帝的人来说,“主标志”是附庸国配置中的一个。