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
This commit is contained in:
Honza Horak 2018-06-05 10:54:13 +02:00
parent 34627d99ee
commit 4024962c36
2 changed files with 7 additions and 4 deletions

View File

@ -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 <hhorak@redhat.com> - 3:10.2.15-2
- Use mysqladmin for checking the socket
* Wed May 23 2018 Michal Schorm <mschorm@redhat.com> - 3:10.2.15-1
- Rebase to 10.2.15
- CVEs fixed: #1568962

View File

@ -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