diff options
author | Magne Mahre <magne.mahre@oracle.com> | 2011-03-14 14:03:48 +0100 |
---|---|---|
committer | Magne Mahre <magne.mahre@oracle.com> | 2011-03-14 14:03:48 +0100 |
commit | cf2af2bd6f59a1127239bf5ca1588d8b4e7a1c83 (patch) | |
tree | 8037e908cd7c810a60a7bba5f09753e3e240e218 /sql/mysqld.cc | |
parent | 2f5a462fdd9d9b591732dd59d2037a6fbc331142 (diff) | |
download | mariadb-git-cf2af2bd6f59a1127239bf5ca1588d8b4e7a1c83.tar.gz |
Bug#11858960 - WINDOWS SERVICE FAILING TO START IMMEDIATELY AFTER
INSTALLATION
When starting mysqld as an MS Windows NT service, it crashed
with "Error 1067: The process terminated unexpectedly".
The problem is that thread local variables are not allocated
and initialized properly when started as a service. When the
server is started as a regular executable, the problem does
not occur.
Analysis showed that this is a regression after the patch for
Bug#11765237/Bug#11763065. Before, the thread local storage
was initialized by the call chain:
win_main->my_basic_init->my_thread_basic_global_init->
my_thread_init
When the my_init() structure was changed, this initialization
was moved from win_main to mysqld_main. When started as
a service win_main is run in a separate thread, which does
not have mysqld_main in its call path, so my_thread_init
is never called for this thread.
Added a call to my_thread_init / my_thread_end in the service
handler function, which solves the problem.
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 53f82e02e97..24ce134b40d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4656,10 +4656,15 @@ int mysqld_main(int argc, char **argv) #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) int mysql_service(void *p) { + if (my_thread_init()) + return 1; + if (use_opt_args) win_main(opt_argc, opt_argv); else win_main(Service.my_argc, Service.my_argv); + + my_thread_end(); return 0; } |