diff options
author | Andrew Chen <a.chen@mongodb.com> | 2020-06-24 20:45:52 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-07 15:00:54 +0000 |
commit | 0230f90f1b8e3bda4af59f4b32b5f265220f420a (patch) | |
tree | 6ee69acc95d2815a167f2310294e8d13468a372a /src/mongo/transport | |
parent | 82fd27960459fd21c57187e0820aa3ceaeaa71c8 (diff) | |
download | mongo-0230f90f1b8e3bda4af59f4b32b5f265220f420a.tar.gz |
SERVER-48509 Catch and log exceptions when creating threads fail
Diffstat (limited to 'src/mongo/transport')
-rw-r--r-- | src/mongo/transport/README.md | 18 | ||||
-rw-r--r-- | src/mongo/transport/service_entry_point_utils.cpp | 8 | ||||
-rw-r--r-- | src/mongo/transport/service_entry_point_utils.h | 2 |
3 files changed, 6 insertions, 22 deletions
diff --git a/src/mongo/transport/README.md b/src/mongo/transport/README.md deleted file mode 100644 index e78e648f584..00000000000 --- a/src/mongo/transport/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Transport Layer -The transport layer assists in ingress traffic to the MongoDB server through the use of Generic Sockets. - -## Internal Ingress Networking -Ingress networking refers to when a running MongoDB instance acts as a server and receives an incoming request from an internal client. - -When a client wants to interact with a MongoDB database, they must first establish a connection, typically over TCP. The Transport Layer runs a Listener on a port (27107 by default) to listen for incoming client connections. Once a client connection is received, the Listener creates a session with that client and a thread is spawned for the lifetime of that connection. - -The connection lifecycle of a single client connection is handled by a state machine. The session takes in the command received from the client and hands it off to a ServiceExecutor. This ServiceExecutor is then passed in to initialize a ServiceStateMachine, which is a state machine that manages the life cycle of the client connection. Eventually, this ServiceExecutor will spawn a thread to handle the command itself or hand it off to either a ClientOutOfLineExecutor or a TaskExecutor to handle instead. - -In order to return the results to the user whether it be a query or a response code, MongoDB uses the ReplyBuilderInterface. This interface acts as a cursor to build a response message to be sent out back to the client. - -#### Code References -* [**ServiceExecutor class**](https://github.com/mongodb/mongo/blob/master/src/mongo/transport/service_executor.h) -* [**ServiceStateMachine class**](https://github.com/mongodb/mongo/blob/master/src/mongo/transport/service_state_machine.h) -* [**ServiceEntryPointImpl class**](https://github.com/mongodb/mongo/blob/master/src/mongo/transport/service_entry_point_impl.h) -* [**ReplyBuilderInterface class**](https://github.com/mongodb/mongo/blob/master/src/mongo/rpc/reply_builder_interface.h) - diff --git a/src/mongo/transport/service_entry_point_utils.cpp b/src/mongo/transport/service_entry_point_utils.cpp index bc2f4722592..dd3fca7b108 100644 --- a/src/mongo/transport/service_entry_point_utils.cpp +++ b/src/mongo/transport/service_entry_point_utils.cpp @@ -61,7 +61,7 @@ void* runFunc(void* ctx) { } } // namespace -Status launchServiceWorkerThread(std::function<void()> task) { +Status launchServiceWorkerThread(std::function<void()> task) noexcept { try { #if defined(_WIN32) @@ -123,8 +123,10 @@ Status launchServiceWorkerThread(std::function<void()> task) { ctx.release(); #endif - } catch (...) { - return {ErrorCodes::InternalError, "failed to create service entry worker thread"}; + } catch (std::exception& e) { + std::string errormsg = "failed to create service entry worker thread, exception: "; + errormsg += e.what(); + return {ErrorCodes::InternalError, errormsg}; } return Status::OK(); diff --git a/src/mongo/transport/service_entry_point_utils.h b/src/mongo/transport/service_entry_point_utils.h index 9f697dcf4b1..c63afc5027b 100644 --- a/src/mongo/transport/service_entry_point_utils.h +++ b/src/mongo/transport/service_entry_point_utils.h @@ -35,6 +35,6 @@ namespace mongo { -Status launchServiceWorkerThread(std::function<void()> task); +Status launchServiceWorkerThread(std::function<void()> task) noexcept; } // namespace mongo |