Official-images: Mysql image does not do a clean db shutdown when stopping

Created on 23 Oct 2016  路  3Comments  路  Source: docker-library/official-images

To see that, just check /var/log/mysql/error log after stopping and restarting the image, and you will see:

2016-10-23 11:54:20 373 [Note] InnoDB: Database was not shutdown normally!
2016-10-23 11:54:20 373 [Note] InnoDB: Starting crash recovery.

This happens every time.

I understand that DBs are supposed to be able to withstand this kind of occurrence.
But wouldn't it be nice if the shutdown was handled more gracefully, so there is less risk of data corruption / transaction problems ?

According to the MySQL docs, the DB should shut down cleanly when it receives a sigterm (http://dev.mysql.com/doc/refman/5.6/en/server-shutdown.html), which, afaik, is the way that Docker uses to stop containers. Maybe then it is just a timeout issue? Or maybe the messages in the mysql logs are harmless?

Most helpful comment

Hello again.

I added to my scripts "-t 60", and it still does not seem to be working right: mysql does not stop within 60 seconds of receiving the SIGTERM. Considering that it has 0 connections open, it seems weird...
I am investigating more

All 3 comments

If you are doing docker stop then docker sends a SIGTERM and if the process does not stop in 10 seconds, it will then send the SIGKILL. If your database needs more time to stop, then you should either increase the timeout on docker stop with -t or just send the signals separately with docker kill -s.

Hello again.

I added to my scripts "-t 60", and it still does not seem to be working right: mysql does not stop within 60 seconds of receiving the SIGTERM. Considering that it has 0 connections open, it seems weird...
I am investigating more

@gggeek I hope you don't mind, but I'm going to close this now -- if you did more debugging and found the source, it'd be great to have some notes about what the issue was :smile:

In the future, issues like this should be filed on the MySQL repo instead (https://github.com/docker-library/mysql/issues) :+1:

Was this page helpful?
0 / 5 - 0 ratings