-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Internal Code
-
Fully Compatible
-
v6.1, v6.0, v5.0, v4.4
-
Service Arch 2022-10-17
-
5
The interface for TransportLayer::start is designed to return a Status, however, TransportLayerASIO internally uses an invariant to verify that the instance of TransportLayer is not shutdown: https://github.com/mongodb/mongo/blob/6f450a3cea6287612329f44e90536d72fe7c16c5/src/mongo/transport/transport_layer_asio.cpp#L1371
This can cause an unnecessary server-crash if the main thread attempts to start the TransportLayer after a shutdown is initiated.
A possible solution to fix this issue is to return a shutdown error and properly handle this non-okay Status at the initialization site, thus, avoid crashing the server when shutdown is in progress.