Bug #79298 Binary log name freed before error message printed
Submitted: 16 Nov 2015 21:10 Modified: 17 Nov 2015 3:29
Reporter: Sveta Smirnova (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6, 5.7.9 OS:Any
Assigned to: CPU Architecture:Any

[16 Nov 2015 21:10] Sveta Smirnova
Description:
I found in the error log file messages like:

"Could not use (null) for logging (error 0). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it."

This happened on machine where server reported error 28 with plenty of space.

So I searched source code to find out what can be freed and found what name is always freed before log message is printed:

 4805 err:
 4806 #ifdef HAVE_REPLICATION
 4807   if (is_inited_purge_index_file())
 4808     purge_index_entry(NULL, NULL, need_lock_index);
 4809   close_purge_index_file();
 4810 #endif
 4811   end_io_cache(&log_file);
 4812   end_io_cache(&index_file);
 4813   my_free(name);
 4814   name= NULL;
 4815   log_state.atomic_set(LOG_CLOSED);
 4816   if (binlog_error_action == ABORT_SERVER)
 4817   {
 4818     exec_binlog_error_action_abort("Either disk is full or file system is read "
 4819                                    "only while opening the binlog. Aborting the"
 4820                                    " server.");
 4821   }
 4822   else
 4823     sql_print_error("Could not use %s for logging (error %d). "
 4824                     "Turning logging off for the whole duration of the MySQL "
 4825                     "server process. To turn it on again: fix the cause, "
 4826                     "shutdown the MySQL server and restart it.", name, errno);
 4827   DBUG_RETURN(1);
 4828 }

How to repeat:
See description.

Suggested fix:
Do not free binary log file name before printing error message.
[17 Nov 2015 3:29] Shane Bester
thank you for the report!
[5 May 2016 4:44] Umesh Shastry
Bug #81313 marked as duplicate of this