The reloader process does not complete if an error occurs during operation. #2362
Unanswered
skachkovkiril
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When starting unicorn using the command:
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
There is a problem with the completion of the "reloader process [...] using StatReload" if there was an error during any change (as an example: SyntaxError: invalid syntax, ImportError: cannot import name..., etc.). When the server execution is completed in the terminal, the reboot process should also be completed, but instead it continues to work and can be stopped only with the command
taskkill /PID {PID process} /f
When analyzing the library code, it was revealed that in uvicorn/supervisors/basereload.py looping occurs in the BaseReload class in the run() function
I was able to solve this problem by adding a check for self.process.exit code == 0 before checking for "changes". Now the code of this procedure looks like this:
Beta Was this translation helpful? Give feedback.
All reactions