Uvicorn stays alive when all workers are dead. Is this intended behaviour? Could someone explain the benefit of this?
Uvicorn does not seem to restart individual workers if they are dead. Therefore, shouldn't Uvicorn itself exit when there are zero workers left?
A container orchestrator could automatically reload Uvicorn on exit, which would be awesome.
Uvicorn does not seem to restart individual workers if they are dead. Therefore, shouldn't Uvicorn itself exit when there are zero workers left?
Really what we'd like to do here is have the master process restart the child processes.
Either sounds good!
Also would Uvicorn restarting workers obsolete the usage of Gunicorn + Uvicorn workers? Or is Gunicorn also providing additional value that I'm not aware of?
@gnat For many users, yes.
I think we'd probably want to spin the GunicornWorker out into a seperatly managed package at that point, and in general just recommend running uvicorn directly.
Gunicorn gives you some more advanced options wrt. signal handling and restarts, but most users probably don't actually need that.
Hi,
For me the status of this issue is problematic: on the one hand you tell users in the doc to use Uvicorn directly (which I did), and advertise the option --limit-max-requests (which I used for safety), but on the other hand, the master process does not restart the stopped processes, and it's recommended here to actually use Gunicorn. Which is it? Shouldn't the doc be changed to mention that the --limit-max-requests does not actually restart the stopped processes? In which case I believe a little more detail is needed to be able to manually restart them... Or, maybe the doc could indicate that this option should not be used and Gunicorn be used instead to provide the same functionality?
Actually, I should specify that I used supervisor to run the master process, with the following conf
[program:checklist_server]
command=uvicorn --workers 4 backend.asgi:application --limit-max-requests 1000
user=service
autostart=true
autorestart=true
redirect_stderr=true
stopasgroup=true
killasgroup=true
and if the child processes are stopped, as the master still runs, the service is not restarted...
The current behavior is very non-obvious and not what gunicorn users expect.
Please change this to auto-restart.
Most helpful comment
@gnat For many users, yes.
I think we'd probably want to spin the GunicornWorker out into a seperatly managed package at that point, and in general just recommend running uvicorn directly.
Gunicorn gives you some more advanced options wrt. signal handling and restarts, but most users probably don't actually need that.