summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_context.cpp
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2016-08-11 16:03:40 -0400
committerJason Carey <jcarey@argv.me>2016-08-23 14:13:17 -0400
commit07020e0b0cadf1639824f985a3ae6ce09d4c5ee8 (patch)
treeb89e60d25521905f312bc34aefbdf3a6a637c251 /src/mongo/db/service_context.cpp
parentc38c8a9ef540b337cce414f8db4a7b93890926b7 (diff)
downloadmongo-07020e0b0cadf1639824f985a3ae6ce09d4c5ee8.tar.gz
SERVER-25572 Fix ASAN clean shutdown logic
During shutdown a number of things are currently happening that shouldn't be: 1. The legacy transport layer is failing to actually close sockets in closeAll. It's doing this because the default argument to closeAll is to leave all sockets open on the legacy transport layer (versus to close them on the actual interface header). 2. The thing we're checking for in shutdown is wrong. It's just that we've left recv in all db workers, rather than that we've left all client workers (so ASAN is occasionally unhappy about "leaks") 3. Tests rely on external callers to close sockets. when this contract changes, we take an extra 10 seconds to shut down every mongod, making some tests time out. Fix this by adding a counter for actual live workers, so we can track when it's safe to shutdown correctly. Also fix the typo
Diffstat (limited to 'src/mongo/db/service_context.cpp')
-rw-r--r--src/mongo/db/service_context.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp
index 585ffefb430..ffaa0f7f128 100644
--- a/src/mongo/db/service_context.cpp
+++ b/src/mongo/db/service_context.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/client.h"
#include "mongo/db/operation_context.h"
#include "mongo/stdx/memory.h"
+#include "mongo/transport/service_entry_point.h"
#include "mongo/transport/session.h"
#include "mongo/transport/transport_layer.h"
#include "mongo/transport/transport_layer_manager.h"
@@ -158,6 +159,10 @@ transport::TransportLayer* ServiceContext::getTransportLayer() const {
return _transportLayerManager.get();
}
+ServiceEntryPoint* ServiceContext::getServiceEntryPoint() const {
+ return _serviceEntryPoint.get();
+}
+
Status ServiceContext::addAndStartTransportLayer(std::unique_ptr<transport::TransportLayer> tl) {
return _transportLayerManager->addAndStartTransportLayer(std::move(tl));
}
@@ -186,6 +191,10 @@ void ServiceContext::setPreciseClockSource(std::unique_ptr<ClockSource> newSourc
_preciseClockSource = std::move(newSource);
}
+void ServiceContext::setServiceEntryPoint(std::unique_ptr<ServiceEntryPoint> sep) {
+ _serviceEntryPoint = std::move(sep);
+}
+
void ServiceContext::ClientDeleter::operator()(Client* client) const {
ServiceContext* const service = client->getServiceContext();
{