nvgoldin / mirrorchecker

0 stars 0 forks source link

Fix graceful shutdown #1

Open nvgoldin opened 8 years ago

nvgoldin commented 8 years ago
  1. some of the shutdown methods aren't using await properly, leading to exceptions when instance is down.
  2. add signal handlers, which later would allow an external script to start/stop the service.
nvgoldin commented 8 years ago

This now works on master for SIGTERM only, SIGKILL(i.e. CTRL+C) does not work. For unknown reason when sending SIGKILL signal, the thread which wraps _send_scp method and is running inside a ThreadPoolExecutor is being starved so it never ends its loop, despite the cancel_event being set. This is extremely weird as it works flawlessly with SIGTERM signal. I've seen similar reports, though not exact, of this issue in asyncio: https://github.com/python/asyncio/issues/376