diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2017-10-25 17:15:39 -0400 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2017-11-02 13:02:01 -0400 |
commit | acdd51da0bda6f8bb723dd23096306a3453c8804 (patch) | |
tree | 16ed5253a5ddb3f7debb80c9a24ffddf2c998f6b | |
parent | 5b765943f8e28441d18927cf8182c429c246250c (diff) | |
download | mongo-acdd51da0bda6f8bb723dd23096306a3453c8804.tar.gz |
SERVER-31724 Call TransportLayer shutdown during normal server shutdown
-rw-r--r-- | src/mongo/db/db.cpp | 15 | ||||
-rw-r--r-- | src/mongo/transport/transport_layer_legacy.cpp | 1 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 03f3a8590d1..b18a5b40010 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -1223,8 +1223,11 @@ void shutdownTask() { auto const client = Client::getCurrent(); auto const serviceContext = client->getServiceContext(); - log(LogComponent::kNetwork) << "shutdown: going to close listening sockets..."; - ListeningSockets::get()->closeAll(); + // Shutdown the TransportLayer so that new connections aren't accepted + if (auto tl = serviceContext->getTransportLayer()) { + log(LogComponent::kNetwork) << "shutdown: going to close listening sockets..."; + tl->shutdown(); + } if (serviceContext->getGlobalStorageEngine()) { ServiceContext::UniqueOperationContext uniqueOpCtx; @@ -1287,14 +1290,6 @@ void shutdownTask() { // the lifecycle of a connection and request. When we are running under ASAN, we try a lot // harder to dry up the server from active connections before going on to really shut down. - // Shutdown the TransportLayer so that new connections aren't accepted - if (auto tl = serviceContext->getTransportLayer()) { - log(LogComponent::kNetwork) - << "shutdown: going to close all sockets because ASAN is active..."; - - tl->shutdown(); - } - // Shutdown the Service Entry Point and its sessions and give it a grace period to complete. if (auto sep = serviceContext->getServiceEntryPoint()) { if (!sep->shutdown(Seconds(10))) { diff --git a/src/mongo/transport/transport_layer_legacy.cpp b/src/mongo/transport/transport_layer_legacy.cpp index d10d68e521e..0deea151158 100644 --- a/src/mongo/transport/transport_layer_legacy.cpp +++ b/src/mongo/transport/transport_layer_legacy.cpp @@ -205,6 +205,7 @@ void TransportLayerLegacy::_closeConnection(Connection* conn) { void TransportLayerLegacy::shutdown() { _running.store(false); + ListeningSockets::get()->closeAll(); _listener->shutdown(); if (_listenerThread.joinable()) { _listenerThread.join(); |