Bug #74720 No warn/error message if "log-error" is misconfigured (causing latent log loss)
Submitted: 6 Nov 2014 21:50 Modified: 6 Nov 2014 23:07
Reporter: Tianyin Xu Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Logging Severity:S2 (Serious)
Version:5.5, 5.6 OS:Linux
Assigned to: CPU Architecture:Any
Tags: log-error

[6 Nov 2014 21:50] Tianyin Xu
When the "log-error" option (the path of the error logs) is misconfigured, the MySQL server (mysqld) silently ignores the erroneous setting without any warning or error message.

I happened to put a path which MySQL failed to create, while MySQL did not complain but kept running. The latent error causes the loss of all the error logs.

This is very different from the "log_bin" option (the path of binary logs). 
With a similar semantic, these two options behave very different in this case. If the "log_bin" path is wrong, the MySQL server complains immediately and refuses to start. 

How to repeat:
Assign a wrong path to the "log-error" option in the [mysqld] section,

log-error = "I_am_a_wrong_path"

Then start mysqld, there's no warning or error message, and everything seems perfectly fine.

Suggested fix:
*Check and print warning or error messages when the error log cannot be generated or written to.*

Just like what MySQL checks "log-bin", I put the same erroneous path to log_bin, and MySQL would complain and refuse to start (as follows)

./bin/mysqld: File '/var/log/mysql/mysql-bin.index' not found (Errcode: 2)
141106 13:28:25 [ERROR] Aborting
141106 13:28:25 [Note] ./bin/mysqld: Shutdown complete
[6 Nov 2014 22:46] MySQL Verification Team
Thank you for the bug report. Please check the Manual:


"Log errors and startup messages to this file. See Section 5.2.2, “The Error Log”. If you omit the file name, MySQL uses host_name.err. If the file name has no extension, the server adds an extension of .err. "

The test case you provide:

miguel@miguelpc ~ $ cat /home/miguel/dbs/5.6/my.cnf | grep log-error
miguel@miguelpc ~ $ ls /home/miguel/dbs/5.6/data/*.err
miguel@miguelpc ~ $
[6 Nov 2014 22:52] Tianyin Xu
Hi Miguel,

Sorry I guess I misled you by using a faked path ("I_am_a_wrong_path"). Surely I didn't use such a path in my system. 

By "a wrong path", I mean a path that cannot be accessed by MySQLd. In my case, it's a path that MySQLd does not have the privilege to access. You can use the path "/" if you do not start MySQLd with root. 

In this case, the .err won't be generated and nothing is reported.

[6 Nov 2014 23:07] MySQL Verification Team
Thank you for the feedback.