Bug in 4.0.17 mysqld_safe - deletes /var/lib/mysql/mysql.sock
am 26.01.2004 19:33:19 von donald.murrayWe recently discovered a bug in the mysqld_safe script in MySQL's
MySQL-server-4.0.17-0 RPM. This is similar to the previously
reported 'Socket problem in mysqld_safe for 4.0.16'.
We run a master and slave on the same server. The master uses the
default socket /var/lib/mysql/mysql.sock. The slave uses
/var/lib/mysql/msyql-slave.sock.
Our config files contain [mysqld_safe] sections which specify
the correct socket, as do the [mysqld] sections.
If we start the master, then start the slave, the master's socket
file always gets deleted. At first I thought we just needed to
add a 'socket = ...' stanza in [mysqld_safe], but this did not
fix the problem.
Turns out the problem lies in mysqld_safe. Very early on in this
script we see the following line:
safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/ var/lib/mysql/mysql.sock}}
This apparently sets $safe_mysql_unix_port to '/var/lib/mysql/mysql.sock'.
After setting this variable, mysqld_safe then parses any specified config
file, and then any command-line arguments. At no point is $safe_mysql_unix_port
updated with config-file or command-line settings.
Later, we see the following extra bit of safety:
rm -f $safe_mysql_unix_port $pid_file # Some extra safety
Because $safe_mysql_unix_port is still set to /var/lib/mysql/mysql.sock,
the wrong socket gets deleted.
Our interim fix was to move the assignment of safe_mysql_unix_port to
later in the script; it's now happening after the config-file and command-line
args have been parsed.
------------------------------------------
Donald Murray, P.Eng.
Senior Software Engineer
Pason Systems Corp.
Direct: (403) 301-3473
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org