summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_context.h
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.h
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.h')
-rw-r--r--src/mongo/db/service_context.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h
index ca7808032ab..12b205dba0b 100644
--- a/src/mongo/db/service_context.h
+++ b/src/mongo/db/service_context.h
@@ -47,6 +47,7 @@ class AbstractMessagingPort;
class Client;
class OperationContext;
class OpObserver;
+class ServiceEntryPoint;
namespace transport {
class Session;
@@ -318,6 +319,13 @@ public:
transport::TransportLayer* getTransportLayer() const;
/**
+ * Get the service entry point for the service context.
+ *
+ * See ServiceEntryPoint for more details.
+ */
+ ServiceEntryPoint* getServiceEntryPoint() const;
+
+ /**
* Add a new TransportLayer to this service context. The new TransportLayer will
* be added to the TransportLayerManager accessible via getTransportLayer().
*
@@ -373,6 +381,11 @@ public:
*/
void setPreciseClockSource(std::unique_ptr<ClockSource> newSource);
+ /**
+ * Binds the service entry point implementation to the service context
+ */
+ void setServiceEntryPoint(std::unique_ptr<ServiceEntryPoint> sep);
+
protected:
ServiceContext();
@@ -402,6 +415,11 @@ private:
std::unique_ptr<transport::TransportLayerManager> _transportLayerManager;
/**
+ * The service entry point
+ */
+ std::unique_ptr<ServiceEntryPoint> _serviceEntryPoint;
+
+ /**
* Vector of registered observers.
*/
std::vector<std::unique_ptr<ClientObserver>> _clientObservers;