New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
werkzeug.serving.run_simple does not handle SIGTERM correctly #58
Comments
I bind a signal handler now when run with reloader. Hope that helps. |
In what version is this fix? This is still a problem in Flask 0.8. |
This is still an issue, its quite annoying when using Flask with an IDE - whenever you stop debugging the process persists and continues to serve requests. |
I'm reopening this issue as it seems to persist, see the following discussion from IRC today.
|
I think it's still relevant. Doing |
I've encountered this issue too while reworking the testsuite for |
I ran into this same problem in Flask with debug mode (use_debugger=True). However, I see a return code of 0 on the "parent" process. Without debug mode enabled, SIGTERM works fine and the process exits with code 143. Python 2.7.5. |
Got hit by this bug as well, in my case The workaround was to specify |
I have the same problem while running a Flask app inside of Docker; however, |
I cannot recreate the issue. I have tried this with the official Python container with the 2.7 and 3.7 tag. I used the following Dockerfile:
And built a container from the Dockerfile in the docker build -t werkzeug-examples . I would then run the container in interactive mode and cancel with: $ docker run -it --name werkzeug-example werkzeug-examples
* Running on http://localhost:5000/ (Press CTRL+C to quit)
* Restarting with stat
^C Running $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8c708ea4ef77 werkzeug-examples "python manage-short…" About a minute ago Exited (0) 58 seconds ago werkzeug-example Running the container and stopping with Here is the result of Docker Version on the computer I ran these commands:
Can you provide an example which can reproduce the issue you are experiencing? |
Until we can get a reproducible scenario, I will close this as it cannot be reproduced in the latest version of Docker and Werkzeug. |
When the process receives
SIGTERM
, it should shut down and exit, with as few operations as possible and without printing anything.A
werkzeug.serving.run_simple
process receivingSIGTERM
generally result in a return code of 141 (symptom of an un/mishandledSIGPIPE
), and when using the reloader the process goes zombie (it has to be killed manually, as the port stays bound).Adding a signal handler for
SIGTERM
which simply invokessys.exit(0)
is sufficient to fix the issue (in that there is no more misbehavior of the process), but I am not sure it's the actually correct fix.The text was updated successfully, but these errors were encountered: