ytyou / ticktock

TickTockDB is an OpenTSDB-like time series database, with much better performance.
GNU General Public License v3.0
76 stars 9 forks source link

fixed `docker stop` to trigger clean shutdown for tt executable #50

Closed jens-ylja closed 1 year ago

jens-ylja commented 1 year ago

When using the Docker image to run ticktock I noticed docker stop to both take a long time and not cleanly terminating the ticktock executable. To verify the erroneous behaviour, please:

When drilling down this, the reason/solution was simple -> ticktock has to be run with exec in entrypoint.sh. For further explanation please see e.g. https://madflojo.medium.com/shutdown-signals-with-docker-entry-point-scripts-5e560f4e2d45.

This PR contains the according fix. To verify the fixed behaviour, please re-execute the procedure described above - you should now see the [INFO] [main] Shutdown process complete log message.

Note: The Dockerfile contains a STOPSIGNAL SIGINT statement which isn't really neded (for my opinion). Docker uses SIGTERM by default which in my tests seemed to work the same way.

ytyou commented 1 year ago

We registered the exact same handler for both SIGINT and SIGTERM, so yes, if Docker uses SIGTERM by default, then STOPSIGNAL SIGINT is not needed.

jens-ylja commented 1 year ago

We registered the exact same handler for both SIGINT and SIGTERM, so yes, if Docker uses SIGTERM by default, then STOPSIGNAL SIGINT is not needed.

OK, I'll update the PR on Monday - my todays working session is over.