From 4024962c36324a653bb500225b668c6146f26354 Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Tue, 5 Jun 2018 10:54:13 +0200 Subject: [PATCH] Use mysqladmin for checking the socket This should avoid the long delay and service start failure in case the socket exists, some process is hanging on it, but no replies are sent, like when simulating the server using nc --- mariadb.spec | 5 ++++- mysql-check-socket.sh | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mariadb.spec b/mariadb.spec index 9628466..a5a4fe2 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -146,7 +146,7 @@ Name: mariadb Version: %{compatver}.%{bugfixver} -Release: 1%{?with_debug:.debug}%{?dist} +Release: 2%{?with_debug:.debug}%{?dist} Epoch: 3 Summary: A community developed branch of MySQL @@ -1575,6 +1575,9 @@ fi %endif %changelog +* Tue Jun 05 2018 Honza Horak - 3:10.2.15-2 +- Use mysqladmin for checking the socket + * Wed May 23 2018 Michal Schorm - 3:10.2.15-1 - Rebase to 10.2.15 - CVEs fixed: #1568962 diff --git a/mysql-check-socket.sh b/mysql-check-socket.sh index b15cd32..5e13108 100644 --- a/mysql-check-socket.sh +++ b/mysql-check-socket.sh @@ -25,10 +25,10 @@ if test -e "$socketfile" ; then fi # some process uses the socket file - if fuser "$socketfile" &>/dev/null ; then - socketpid=$(fuser "$socketfile" 2>/dev/null) + response=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER --connect-timeout="${CHECKSOCKETTIMEOUT:-10}" ping 2>&1` + if [ $? -qe 0 ] || echo "$response" | grep -q "Access denied for user" ; then echo "Is another MySQL daemon already running with the same unix socket?" >&2 - echo "Please, stop the process $socketpid or remove $socketfile manually to start the service." >&2 + echo "Please, stop the process using the socket $socketfile or remove the file manually to start the service." >&2 exit 1 fi