Bug #66490 socket file already exists, mysqld already running
Submitted: 22 Aug 2012 6:39 Modified: 24 Jun 2014 7:40
Reporter: yang ww Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Cluster Manager: Agent Severity:S3 (Non-critical)
Version:1.1.6, 1.3.1 OS:Linux
Assigned to: Thomas Nielsen CPU Architecture:Any
Tags: cluster, mcm

[22 Aug 2012 6:39] yang ww
Description:
when I start my cluster, error occurred as follow:

mysql> start cluster mycluster;
ERROR 7006 (00MGR): Process error: socket file already exists, mysqld already running?

But I cannot find the socket.Please help me.

How to repeat:
mysql> show status -r mycluster;
+--------+----------+---------------+--------+-----------+---------+
| NodeId | Process  | Host          | Status | Nodegroup | Package |
+--------+----------+---------------+--------+-----------+---------+
| 49     | ndb_mgmd | 192.168.75.42 | added  |           | 7.2.5   |
| 1      | ndbd     | 192.168.75.43 | added  | n/a       | 7.2.5   |
| 2      | ndbd     | 192.168.75.44 | added  | n/a       | 7.2.5   |
| 50     | mysqld   | 192.168.75.43 | added  |           | 7.2.5   |
| 51     | mysqld   | 192.168.75.44 | added  |           | 7.2.5   |
+--------+----------+---------------+--------+-----------+---------+
5 rows in set (0.09 sec)
[21 Jun 2014 7:28] MySQL Verification Team
Thank you for the report.
I'm able to reproduce this issue after manually restarting one of the mysqld when the agent/cluster was completely down. 
Later attempt to start the cluster resulted in reported error.
Workaround - Kill the mysqld and restart again.
[21 Jun 2014 7:29] MySQL Verification Team
//

mcm>start cluster mycluster;
ERROR 7006 (00MGR): Process error: socket file /tmp/mysql.mycluster.51.sock already exists for process mysqld 5 on cluster-repo. Is a mysqld already running?
mcm>
mcm>start cluster mycluster;
ERROR 7006 (00MGR): Process error: socket file /tmp/mysql.mycluster.51.sock already exists for process mysqld 5 on cluster-repo. Is a mysqld already running?
mcm>show status -r mycluster;
+--------+----------+--------------+---------+-----------+-----------+
| NodeId | Process  | Host         | Status  | Nodegroup | Package   |
+--------+----------+--------------+---------+-----------+-----------+
| 49     | ndb_mgmd | cluster-repo | stopped |           | mypackage |
| 1      | ndbd     | cluster-repo | stopped | 0         | mypackage |
| 2      | ndbd     | cluster-repo | stopped | 0         | mypackage |
| 50     | mysqld   | cluster-repo | stopped |           | mypackage |
| 51     | mysqld   | cluster-repo | stopped |           | mypackage |
| 52     | ndbapi   | *            | added   |           |           |
+--------+----------+--------------+---------+-----------+-----------+
6 rows in set (0.09 sec)

mcm>stop process 51 mycluster;
+------------------------------+
| Command result               |
+------------------------------+
| Process stopped successfully |
+------------------------------+
1 row in set (2.28 sec)

mcm>show status -r mycluster;
+--------+----------+--------------+---------+-----------+-----------+
| NodeId | Process  | Host         | Status  | Nodegroup | Package   |
+--------+----------+--------------+---------+-----------+-----------+
| 49     | ndb_mgmd | cluster-repo | stopped |           | mypackage |
| 1      | ndbd     | cluster-repo | stopped | 0         | mypackage |
| 2      | ndbd     | cluster-repo | stopped | 0         | mypackage |
| 50     | mysqld   | cluster-repo | stopped |           | mypackage |
| 51     | mysqld   | cluster-repo | stopped |           | mypackage |
| 52     | ndbapi   | *            | added   |           |           |
+--------+----------+--------------+---------+-----------+-----------+
6 rows in set (0.06 sec)

mcm>start cluster mycluster;
ERROR 7006 (00MGR): Process error: socket file /tmp/mysql.mycluster.51.sock already exists for process mysqld 5 on cluster-repo. Is a mysqld already running?
mcm>
[24 Jun 2014 7:40] Thomas Nielsen
The reason MCM rejects the start in this case is MCM has no way of knowing
whether the existing socket belongs to another running mysqld instance, if
its a leftover file from a previously running mysqld, or simply any existing
ordinary file with an identical name. For this very reason, MCM cannot simply
remove the offending file, and continue starting the mysqld. The error seen
is hence "by design".

The errormessage has also been vastly improved since MCM 1.1.6, and now also
list the filename of the offending socket:

mcm>start cluster mycluster;
ERROR 7006 (00MGR): Process error: socket file /tmp/mysql.mycluster.51.sock
already exists for process mysqld 5 on hostA. Is a mysqld already running?

It's possible to find the socket value using the "get" command:

mcm>get socket:mysqld mycluster;
+--------+------------------------------+----------+---------+----------+-----
----+-------+---------+
| Name   | Value                        | Process1 | NodeId1 | Process2 |
NodeId2 | Level | Comment |
+--------+------------------------------+----------+---------+----------+-----
----+-------+---------+
| socket | /tmp/mysql.mycluster.50.sock | mysqld   | 50      |          |
    |       |         |
| socket | /tmp/mysql.mycluster.51.sock | mysqld   | 51      |          |
    |       |         |
+--------+------------------------------+----------+---------+----------+-----
----+-------+---------+
2 rows in set (0.10 sec)

Closing as not a bug.