summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2008-11-14 02:01:41 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2008-11-14 02:01:41 +0100
commitea0efe4526397b6fbc3a5795f8c35b6d4e943baa (patch)
treedc2b286e5971664d1cad910fc946e7e50a7381b0 /sql/mysqld.cc
parentd60da1c2a741dc06e1061573afb078384433c9f8 (diff)
downloadmariadb-git-ea0efe4526397b6fbc3a5795f8c35b6d4e943baa.tar.gz
Bug #20430 mysqld.exe windows service stuck in "SERVICE_STOP_PENDING"
status The problem appears to be a race condition, when service is being stopped right after startup. We set the service status to SERVICE_RUNNING way too early it cannot yet handle stop requests - initialization has not finished and hEventShutdown that signals server to stop is not yet created. If somebody issues "net stop MySQL" at this time, MySQL is not informed about the stop and continues to run as usual, while NTService::ServiceMain() stucks forever waiting for mysql's "main" thread to finish. Solution is to remain in SERVICE_START_PENDING status until after server initialization is fully complete and only then change the status to SERVICE_RUNNING. In SERVICE_START_PENDING we do not accept service control requests, i.e it is not possible to stop service in that time.
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c3e5449b22b..ba6c8c6169f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3840,6 +3840,9 @@ we force server id to 2, but this MySQL server will not act as a slave.");
: mysqld_unix_port),
mysqld_port,
MYSQL_COMPILATION_COMMENT);
+#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
+ Service.SetRunning();
+#endif
#if defined(__NT__) || defined(HAVE_SMEM)
handle_connections_methods();