[mariadb/f19] Check if socket file is not being used by another process at a time of starting the service Related:

Honza Horak hhorak at fedoraproject.org
Mon Jan 6 17:32:43 UTC 2014


commit 9c10493accb9c54c417e15798ff4967fa1c26e40
Author: Honza HorĂ¡k <hhorak at redhat.com>
Date:   Mon Jan 6 12:08:06 2014 +0100

    Check if socket file is not being used by another process at a time of starting the service
    Related: #1045435

 mariadb.spec          |    3 +++
 mysqld-prepare-db-dir |   10 ++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/mariadb.spec b/mariadb.spec
index 7f690a8..c16bec8 100644
--- a/mariadb.spec
+++ b/mariadb.spec
@@ -788,6 +788,9 @@ fi
 - Don't test EDH-RSA-DES-CBC-SHA cipher, it seems to be removed from openssl
   which now makes mariadb/mysql FTBFS because openssl_1 test fails
   Related: #1044565
+- Check if socket file is not being used by another process at a time
+  of starting the service
+  Related: #1045435
 
 * Wed Nov 27 2013 Honza Horak <hhorak at redhat.com> 1:5.5.34-2
 - Fix mariadb-wait-ready script
diff --git a/mysqld-prepare-db-dir b/mysqld-prepare-db-dir
index f73bc66..1807e8f 100644
--- a/mysqld-prepare-db-dir
+++ b/mysqld-prepare-db-dir
@@ -50,6 +50,16 @@ chown "$myuser:$mygroup" "$errlogfile"
 chmod 0640 "$errlogfile"
 [ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile"
 
+# We check if there is already a process using the socket file,
+# since otherwise this systemd service file could report false
+# positive result when starting and mysqld_safe could remove
+# a socket file, which actually uses a different daemon.
+if fuser "$socketfile" &>/dev/null ; then
+    echo "Socket file $socketfile exists." >&2
+    echo "Is another MySQL daemon already running with the same unix socket?" >&2
+    exit 1
+fi
+
 # Make the data directory
 if [ ! -d "$datadir/mysql" ] ; then
     # First, make sure $datadir is there with correct permissions


More information about the scm-commits mailing list