diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2017-02-10 14:23:06 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2017-02-10 14:23:06 -0500 |
commit | 50e9769099bb49220783f95c9045dd1259a18eb4 (patch) | |
tree | 91ae1cc9712a09b0983bde8afa00a8a7ad9d6c4f /src/mongo | |
parent | 31e5c31a79b2043d0fa4288c0435fdfce4348343 (diff) | |
download | mongo-50e9769099bb49220783f95c9045dd1259a18eb4.tar.gz |
SERVER-6065 NT Service stop does not exit cleanly
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/util/exit.cpp | 2 | ||||
-rw-r--r-- | src/mongo/util/ntservice.cpp | 13 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/mongo/util/exit.cpp b/src/mongo/util/exit.cpp index 53ba2dd55e1..2c0b09e87db 100644 --- a/src/mongo/util/exit.cpp +++ b/src/mongo/util/exit.cpp @@ -155,7 +155,7 @@ void shutdownNoTerminate() { { stdx::lock_guard<stdx::mutex> lock(shutdownMutex); shutdownTasksInProgress = false; - shutdownExitCode.emplace(EXIT_WINDOWS_SERVICE_STOP); + shutdownExitCode.emplace(EXIT_CLEAN); } shutdownTasksComplete.notify_all(); diff --git a/src/mongo/util/ntservice.cpp b/src/mongo/util/ntservice.cpp index 362644e4ff8..edcf716e1a6 100644 --- a/src/mongo/util/ntservice.cpp +++ b/src/mongo/util/ntservice.cpp @@ -524,25 +524,22 @@ bool reportStatus(DWORD reportState, DWORD waitHint, DWORD exitCode) { // Minimum of time we tell Windows to wait before we are guilty of a hung shutdown const int kStopWaitHintMillis = 30000; -// Run exitCleanly on a separate thread so we can report progress to Windows +// Run shutdownNoTerminate on a separate thread so we can report progress to Windows // Note: Windows may still kill us for taking too long, // On client OSes, SERVICE_CONTROL_SHUTDOWN has a 5 second timeout configured in // HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control static void serviceStop() { - // VS2013 Doesn't support future<void>, so fake it with a bool. - stdx::packaged_task<bool()> exitCleanlyTask([] { + stdx::packaged_task<void()> shutdownNoTerminateTask([] { setThreadName("serviceStopWorker"); // Stop the process - // TODO: SERVER-5703, separate the "cleanup for shutdown" functionality from - // the "terminate process" functionality in exitCleanly. - exitCleanly(EXIT_WINDOWS_SERVICE_STOP); + shutdownNoTerminate(); return true; }); - stdx::future<bool> exitedCleanly = exitCleanlyTask.get_future(); + stdx::future<void> exitedCleanly = shutdownNoTerminateTask.get_future(); // Launch the packaged task in a thread. We needn't ever join it, // so it doesn't even need a name. - stdx::thread(std::move(exitCleanlyTask)).detach(); + stdx::thread(std::move(shutdownNoTerminateTask)).detach(); const auto timeout = Milliseconds(kStopWaitHintMillis / 2); |