#At file:///export/home/tmp/x/mysql-trunk-bugfixing-58179/ based on revid:anitha.gopi@stripped
3426 Magne Mahre 2010-12-14
Bug #58179 cannot start mysqld with app verifier
Bug #55730 kill_server() calls SetEvent on a null handle,
smem_event_connect_request
Application Verifier is a Microsoft tool used for
detecting certain classes of programming errors.
In particular, MS Windows OS resource usage is
monitored for wrong usage (handles, thread local
storage, critical sections, ...)
In MySQL 5.5.x, an error was introduced where an
object on thread local storage was used before the
TLS and the object was created.
The fix has been to move the mysys initialization
to an earlier stage in the boot process when built for
Windows. For non-win builds, the init already happens
early.
Some un-tangling of calls to my_init(), my_basic_init()
and my_thread_global_init() was done. There is no
longer a need to do init in steps, so the full my_init()
is called instead of my_init_basic().
In addition, Bug#55730 was fixed. The event handle
'smem_event_connect_request' is only created if
'opt_enable_shared_memory' is set. When killing the
server, an event was flagged on the handle
unconditionally. Added a test, so it will only be
flagged if created.
@ mysys/my_init.c
my_thread_global_init is already called from
my_basic_init.
modified:
mysys/my_init.c
sql/mysqld.cc
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c 2010-08-16 12:50:27 +0000
+++ b/mysys/my_init.c 2010-12-14 13:38:41 +0000
@@ -138,10 +138,6 @@ my_bool my_init(void)
if (my_basic_init())
return 1;
-#ifdef THREAD
- if (my_thread_global_init())
- return 1;
-#endif /* THREAD */
{
DBUG_ENTER("my_init");
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-12-07 18:11:49 +0000
+++ b/sql/mysqld.cc 2010-12-14 13:38:41 +0000
@@ -1276,12 +1276,15 @@ static void __cdecl kill_server(int sig_
#if defined(HAVE_SMEM) && defined(__WIN__)
/*
Send event to smem_event_connect_request for aborting
- */
- if (!SetEvent(smem_event_connect_request))
- {
- DBUG_PRINT("error",
- ("Got error: %ld from SetEvent of smem_event_connect_request",
- GetLastError()));
+ */
+ if (opt_enable_shared_memory)
+ {
+ if (!SetEvent(smem_event_connect_request))
+ {
+ DBUG_PRINT("error",
+ ("Got error: %ld from SetEvent of smem_event_connect_request",
+ GetLastError()));
+ }
}
#endif
@@ -4429,17 +4432,21 @@ int win_main(int argc, char **argv)
int mysqld_main(int argc, char **argv)
#endif
{
+#ifndef __WIN__
/*
Perform basic thread library and malloc initialization,
to be able to read defaults files and parse options.
+
+ NOTE: When built for __WIN__, this initialization is
+ done in the win-specific mysqld_main function
*/
my_progname= argv[0];
- if (my_basic_init())
+ if (my_init())
{
- fprintf(stderr, "my_basic_init() failed.");
+ fprintf(stderr, "my_init() failed.");
return 1;
}
-
+#endif
orig_argc= argc;
orig_argv= argv;
if (load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv))
@@ -4539,7 +4546,6 @@ int mysqld_main(int argc, char **argv)
}
#endif /* HAVE_PSI_INTERFACE */
- my_init(); // init my_sys library & pthreads
init_error_log_mutex();
/* Set signal used to kill MySQL */
@@ -4977,6 +4983,18 @@ int mysqld_main(int argc, char **argv)
/* Must be initialized early for comparison of service name */
system_charset_info= &my_charset_utf8_general_ci;
+ /*
+ Perform basic thread library and malloc initialization,
+ to be able to read defaults files and parse options.
+ */
+ my_progname= argv[0];
+ if (my_init())
+ {
+ fprintf(stderr, "my_init() failed.");
+ return 1;
+ }
+
+
if (Service.GetOS()) /* true NT family */
{
char file_path[FN_REFLEN];
Attachment: [text/bzr-bundle] bzr/magne.mahre@oracle.com-20101214133841-nyw99h74w6a9agl7.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk-bugfixing branch (magne.mahre:3426) Bug#55730Bug#58179 | Magne Mahre | 14 Dec |