Bug #71194 mysqld daemon should check if any process uses the socket file before removing

Submitted: 20 Dec 2013 20:33 Modified: 20 Dec 2013 22:39
Reporter: Honza Horak (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.5.35, 5.6.16 OS:Linux
Assigned to: CPU Architecture:Any

[20 Dec 2013 20:33] Honza Horak
Description:
When running some MySQL daemon A and we are trying to run another instance B, while these conditions are met:
* network ports are different for A and B
* unix socket location is the same for A and B

Then the new daemon B removes the unix socket file that is actually necessary for daemon A.

How to repeat:
Steps to reproduce:
$ /usr/libexec/mysqld --port 13306 --datadir /var/lib/mysql/
$ fuser /var/lib/mysql/mysql.sock
$ /usr/libexec/mysqld --port 13307 --datadir /var/lib/mysql2/
$ fuser /var/lib/mysql/mysql.sock

Actual results:
/var/lib/mysql/mysql.sock:  5683
/var/lib/mysql/mysql.sock:  5717
which means the first daemon is not able to accept connections on the unix socket

Expected results:
/var/lib/mysql/mysql.sock:  5683
/var/lib/mysql/mysql.sock:  5683
the second daemon shouldn't start at all

Suggested fix:
Either check if some proc is attached to the socket or (portable solution) having a lock file for the socket file, that would contain pid of the process using the socket file.
[20 Dec 2013 20:36] Honza Horak
Socket file is also removed in the mysqld_safe script. This is wrong imho, so I'd propose to remove this removal in mysqld_safe and let it only for mysqld binary.
[20 Dec 2013 22:39] Sveta Smirnova
Thank you for the report.

Verified as described.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.