You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In the debug mode, if you do not change your source code to trigger auto reload, the stop signals(SIGTERM, SIGINT) send to the main process will not work properly to stop the worker sub-process. As the following code, run it and stop(Ctrl-C), the on_shutdown method will not be called.
# v18.12.0
from sanic import Sanic
app = Sanic(__name__)
@app.listener('after_server_stop')
def on_shutdown(app, loop):
print('I am done!')
app.run(debug=True)
I think the problem maybe caused by the following code in reloader_helpers.py:
Because of creating worker_process before register signal hander(kill_program_completly), the woker_process still use the default signal handler and do not kill sub-process woker.
The following snippet is a immature solution, just for reference:
Describe the bug
In the debug mode, if you do not change your source code to trigger auto reload, the stop signals(SIGTERM, SIGINT) send to the main process will not work properly to stop the worker sub-process. As the following code, run it and stop(Ctrl-C), the
on_shutdown
method will not be called.I think the problem maybe caused by the following code in
reloader_helpers.py
:Because of creating worker_process before register signal hander(
kill_program_completly
), the woker_process still use the default signal handler and do not kill sub-process woker.The following snippet is a immature solution, just for reference:
The text was updated successfully, but these errors were encountered: