Bug #86854 MySQL Cluster entrypoint.sh does not start apps with exec
Submitted: 28 Jun 2017 19:09 Modified: 17 Aug 2017 14:35
Reporter: Sean McDowell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Package Repos and Docker Images Severity:S3 (Non-critical)
Version:7.5 OS:Linux
Assigned to: Lars Tangvald CPU Architecture:Any

[28 Jun 2017 19:09] Sean McDowell
Description:
The mysql/mysql-cluster Docker image uses the entrypoint.sh script to launch the various MySQL processes.

However, none of these are launched using exec.

This means that the bash script remains PID 1 and does not handle the SIGTERM signal.

All processes should be started with exec (as the default action of entrypoint.sh does) so that Docker can gracefully shut them down with docker stop (which sends SIGTERM).

How to repeat:
Start any MySQL cluster application:

id=$(docker run -d mysql/mysql-cluster mysqld)

Stop it:

time docker stop $id

Note that it takes about 10 seconds

Look at its exit status with docker ps -a

It exits with code 137 -- SIGKILL -- because it did not respond to a SIGTERM.

Suggested fix:
Use exec before every command invocation.
[29 Jun 2017 5:57] MySQL Verification Team
Hi Sean,

Thanks for the report.

Looking at the
https://github.com/mysql/mysql-docker/blob/mysql-cluster/7.5/docker-entrypoint.sh

I see we are running custom user commands with exec but ndb* stuff without it. It might be a bug or intentional, I'm not 100% sure but I'll verify the bug and let our devs recheck the reasoning behind not using exec. I do agree that following docker policy we should be starting ndb(mt)d and rest of them with exec

all best
Bogdan Kecman
[29 Jun 2017 8:21] Lars Tangvald
Posted by developer:
 
The images should use exec for all the commands, yes.
The cluster images are at an early experimental stage. We will rewrite them to be more in line with the server images (i.e. have the same features, with the cluster-specific commands added on top).
[17 Aug 2017 14:35] Lars Tangvald
Posted by developer:
 
The MySQL Cluster Docker images are now in line with the server images, functionality-wise.