Bug in 4.0.17 mysqld_safe - deletes /var/lib/mysql/mysql.sock

"Donald Murray P.Eng." <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Organization Pason Systems
Message-ID <[email protected]>
We 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/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.