# At a local mysql-5.1-bugteam repository of davi
2857 Davi Arnaut 2009-04-08
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.
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.
No test case is provided as the infrastructure for testing
the C client API with the embedded server is disabled.
@ mysys/my_init.c
Deinitialize only if initialized already.
@ sql/log.cc
Reset state.
modified:
mysys/my_init.c
sql/log.cc
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c 2009-02-05 06:16:00 +0000
+++ b/mysys/my_init.c 2009-04-09 00:50:21 +0000
@@ -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.
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2009-03-17 20:29:24 +0000
+++ b/sql/log.cc 2009-04-09 00:50:21 +0000
@@ -856,6 +856,10 @@ void LOGGER::cleanup_end()
DBUG_ASSERT(inited == 1);
if (file_log_handler)
delete file_log_handler;
+ inited= 0;
+ table_log_handler= NULL;
+ file_log_handler=NULL;
+ is_log_tables_initialized= FALSE;
}
Attachment: [text/bzr-bundle] bzr/davi.arnaut@sun.com-20090409005021-0fcsserq0ttbfnpc.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (davi:2857) Bug#43706 Bug#44091 | Davi Arnaut | 9 Apr |