summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-04-09 12:25:25 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-04-09 12:25:25 -0300
commit214bd5a121058dfb31237c5326ad28b8c5f8eea3 (patch)
tree88259eaac8d31d3ec748805a745888380eb8f91f /mysys
parent8a41a0ba1f4f5d5ac0172f5bcb78fb636eb38b7a (diff)
downloadmariadb-git-214bd5a121058dfb31237c5326ad28b8c5f8eea3.tar.gz
Bug#43706: libmysqld segfaults when re-intialised
Bug#44091: libmysqld gets stuck waiting on mutex on initialization The problem was that libmysqld wasn't enforcing a certain initialization and deinitialization order for the mysys library. Another problem was that the global object used for management of log event handlers (aka LOGGER) wasn't being prepared for a possible reutilization. What leads to the hang/crash reported is that a failure to load the language file triggers a double call of the cleanup functions, causing an already destroyed mutex to be used. The solution is enforce a order on the initialization and deinitialization of the mysys library within the libmysqld library and to ensure that the global LOGGER object reset it's internal state during cleanup. mysys/my_init.c: Deinitialize only if initialized already. sql/log.cc: Reset state.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_init.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mysys/my_init.c b/mysys/my_init.c
index b330ffac65a..a60927be693 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -136,6 +136,10 @@ void my_end(int infoflag)
*/
FILE *info_file= DBUG_FILE;
my_bool print_info= (info_file != stderr);
+
+ if (!my_init_done)
+ return;
+
/*
We do not use DBUG_ENTER here, as after cleanup DBUG is no longer
operational, so we cannot use DBUG_RETURN.