I'm trying to let uWSGI refresh its workers, because they are leaking a bit of memory. However, after reloading the workers it's no longer responsive. Am I forgetting something?
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 is to test the reloading:
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
Eg uWSGI is no longer responding (connection is alive forever, unless i use curl --max-time). How does uWSGI communicate internally? How does the master process know how to reach the workers? I think something is going wrong there.