systemctl start mysqld fails with timeout if custom path for socket specified

Bug #1534825 reported by Sveta Smirnova
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
High
Tomislav Plavcic
5.5
Fix Released
High
Tomislav Plavcic
5.6
Fix Released
High
Tomislav Plavcic

Bug Description

Fedora 23 Linux evl-db-01 4.2.7-300.fc23.x86_64 #1 SMP Wed Dec 9 22:28:30 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Percona Server 5.6.28:
Percona-Server-client-56-5.6.28-rel76.1.el7.x86_64
Percona-Server-server-56-5.6.28-rel76.1.el7.x86_64
Percona-Server-shared-56-5.6.28-rel76.1.el7.x86_64

If customer uses default socket location (/var/lib/mysql/mysql.sock) ans runs command `systemctl restart mysqld`, systemctl finishes with success.

But if specifies custom path to socket (/opt/evl-db1-data/mysql/mysql.sock) command fails with error: "Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details."

However mysqld actually started.

Tags: pkg
tags: added: pkg
Revision history for this message
Przemek (pmalkowski) wrote :

I did this change to verify this report:

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

And indeed systemctl timeouts after the change:

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

[root@localhost ~]# systemctl start mysqld
Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.

[root@localhost ~]# systemctl status mysqld
* mysqld.service - MySQL Percona Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: activating (start-post) since Mon 2016-01-18 09:21:30 EST; 6min ago
  Process: 6734 ExecStartPre=/usr/bin/mysql-systemd pre (code=exited, status=0/SUCCESS)
 Main PID: 6763 (mysqld_safe); : 6764 (mysql-systemd)
   CGroup: /system.slice/mysqld.service
           |-6763 /bin/sh /usr/bin/mysqld_safe
           |-6982 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/err.log --open-files-limit=548000 --pid-file=/var/lib/mysql/localhost.localdomain.p...
           `-control
             |-6764 /bin/bash /usr/bin/mysql-systemd post
             `-8065 sleep 1

Jan 18 09:21:30 localhost.localdomain systemd[1]: Starting MySQL Percona Server...
Jan 18 09:21:31 localhost.localdomain mysqld_safe[6763]: 160118 09:21:31 mysqld_safe Logging to '/var/lib/mysql/err.log'.
Jan 18 09:21:31 localhost.localdomain mysqld_safe[6763]: 160118 09:21:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@localhost ~]# ps -ef|grep mysqld
root 6763 1 0 09:21 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 6982 6763 0 09:21 ? 00:00:02 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/err.log --open-files-limit=548000 --pid-file=/var/lib/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock
root 8466 11972 0 09:29 pts/2 00:00:00 grep --color=auto mysqld

Server version: 5.6.28-76.1 Percona Server (GPL), Release 76.1, Revision 5759e76

But so was failing the mysql client who still tries to connect to default socket.. But when I also added this to my.cnf:

[mysql]
socket=/tmp/mysql.sock

[client]
socket=/tmp/mysql.sock

the systemctl start mysqld works just fine.

Revision history for this message
Tomislav Plavcic (tplavcic) wrote :
Revision history for this message
Tomislav Plavcic (tplavcic) wrote :

The above fix is for centos7, but the issue has been confirmed on ubuntu trusty also - so debian packaging needs to be updated as well - thus reopening this bug.
I don't think it affects centos 5/6 but it should be tested.

Revision history for this message
Tomislav Plavcic (tplavcic) wrote :

Made further checks, centos 6 is not affected and ubuntu is not affected also although I wrote in my previous comment that it was but I missed one thing.
So on ubuntu you have to change socket option in debian.cnf as well as in my.cnf since in debian/ubuntu that second config file debian.cnf is used for administrative stuff.

Here's proof that it works when you change it properly in all places:
vagrant@t-ubuntu1404-64:~$ sudo /etc/init.d/mysql start
 * Starting MySQL (Percona Server) database server mysqld
   ...done.
 * Checking for corrupt, not cleanly closed and upgrade needing tables.

vagrant@t-ubuntu1404-64:~$ ps aux|grep mysql
root 11302 0.0 0.0 4444 192 pts/0 S 02:49 0:00 /bin/sh /usr/bin/mysqld_safe
mysql 11635 4.3 88.2 1164528 442600 pts/0 Sl 02:49 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/tmp/mysqld.sock --port=3306

vagrant@t-ubuntu1404-64:~$ sudo cat /etc/mysql/my.cnf |grep socket
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
socket = /tmp/mysqld.sock
socket = /tmp/mysqld.sock
socket = /tmp/mysqld.sock

vagrant@t-ubuntu1404-64:~$ sudo cat /etc/mysql/debian.cnf |grep socket
socket = /tmp/mysqld.sock
socket = /tmp/mysqld.sock

vagrant@t-ubuntu1404-64:~$ sudo /etc/init.d/mysql stop
 * Stopping MySQL (Percona Server) mysqld
   ...done.

vagrant@t-ubuntu1404-64:~$ ps aux|grep mysql
vagrant 11819 0.0 0.1 11744 912 pts/0 S+ 02:51 0:00 grep --color=auto mysql

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

Revision history for this message
Sizwan Ahammed (sizwan) wrote :

Reinstalling MySQL might help:

First uninstall the current MySQL
Then delete /var/lib/mysql and /etc/mycnf or /etc/mycng.rpmsave
Reboot the machine
Now install the MySQL again.

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.