systemctl start mysqld fails with timeout if socket isn't specified

Bug #1635752 reported by Marcelo Altmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
New
Undecided
Unassigned
5.6
New
Undecided
Unassigned
5.7
Triaged
Medium
Unassigned

Bug Description

This seems a regression / partial fix of https://bugs.launchpad.net/percona-server/+bug/1534825

Problem:
On RHEL 7, If socket variable isn't specified on my.cnf and datadir is set to a non-standard location, Percona-Server will create a socket on /var/lib/mysql/mysql.sock.
pinger function from /usr/bin/mysql-systemd will read proxy variable from my.cnf. This will return none. Then it will try to check proxy in 3 locations:

        /*) adminsocket="$socket" ;; -- not set
        "") adminsocket="$datadir/mysql.sock" ;; -- $datadir is on a non standard location and socket has been created on /var/lib/mysql/mysql.sock
        *) adminsocket="$datadir/$socket" ;; -- $socket is empty.

Start or restart mysql service via systemctl will fail due to timeout:
[root@localhost data]# systemctl restart mysql
Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.

root@localhost data]# mysql --socket=/var/lib/mysql/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.52-38.3 Percona Server (GPL), Release 38.3, Revision 109ad68

Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

[root@localhost data]# cat /etc/my.cnf | grep socket
[root@localhost data]# cat /etc/my.cnf | grep datadir
datadir=/mysql/data

How to reproduce:
1) Install Percona-Server
2) Change datadir location on my.cnf
3) Remove socket configuration from my.cnf
4) run systemctl [re]start mysql

Tags: pkg regression
description: updated
tags: added: pkg
Changed in percona-server:
assignee: nobody → Muhammad Irfan (muhammad-irfan)
Revision history for this message
Muhammad Irfan (muhammad-irfan) wrote :

I'm able to reproduce this problem. The mysql-systemd post fails to ping when you don't have explicitly set a socket in my.cnf.

$ sh -x /usr/bin/mysql-systemd post
+ case $socket in
+ adminsocket=/data/db/data/mysql.sock
+ /bin/true
+ sleep 1
+ mysqladmin --socket=/data/db/data/mysql.sock ping
+ /bin/true
+ sleep 1
+ mysqladmin --socket=/data/db/data/mysql.sock ping
+ /bin/true
+ sleep 1
+ mysqladmin --socket=/data/db/data/mysql.sock ping
+ /bin/true
+ sleep 1
^C

Socket file doesn't exist in data directory:

$ ls -ltr /data/db/data/mysql.sock
ls: cannot access /data/db/data/mysql.sock: No such file or directory

After adding following line in [mysqld] section in my.cnf file

socket=/var/lib/mysql/mysql.sock

Here is the output of mysql-systemd post after explicitly setting socket file in my.cnf:

$ sh -x /usr/bin/mysql-systemd post
+ socket=/var/lib/mysql/mysql.sock
+ case $socket in
+ adminsocket=/var/lib/mysql/mysql.sock
+ /bin/true
+ sleep 1
+ mysqladmin --socket=/var/lib/mysql/mysql.sock ping
+ break
+ exit 0

Changed in percona-server:
assignee: Muhammad Irfan (muhammad-irfan) → nobody
status: New → Confirmed
tags: added: regression
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1755

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.