diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2016-09-07 11:09:01 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2016-09-07 15:19:33 -0400 |
commit | 884d686aee11eb5e1a30c64ab77089c3ef88ce7a (patch) | |
tree | 5caac2cf60d7dc5bc7eb66358ff8a6943effa052 /src/mongo/s | |
parent | 1f9ece1185c7e40aabe96d8e5dc5a79fea3808f3 (diff) | |
download | mongo-884d686aee11eb5e1a30c64ab77089c3ef88ce7a.tar.gz |
SERVER-25997 Make mongos shutdown safer if the grid object is not yet initialized.
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/server.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 79b149de6d7..92475b6d31c 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -144,10 +144,15 @@ static void cleanupTask() { if (serviceContext) serviceContext->setKillAllOperations(); - auto cursorManager = grid.getCursorManager(); - cursorManager->shutdown(); - grid.getExecutorPool()->shutdownAndJoin(); - grid.catalogClient(txn)->shutDown(txn); + if (auto cursorManager = Grid::get(txn)->getCursorManager()) { + cursorManager->shutdown(); + } + if (auto pool = Grid::get(txn)->getExecutorPool()) { + pool->shutdownAndJoin(); + } + if (auto catalog = Grid::get(txn)->catalogClient(txn)) { + catalog->shutDown(txn); + } } audit::logShutdown(Client::getCurrent()); |