Return an error when starting a `TransportLayer` that is shutdown

XMLWordPrintableJSON

    • Fully Compatible
    • v6.1, v6.0, v5.0, v4.4
    • Service Arch 2022-10-17
    • 5
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Celina Tala
            Reporter:
            Amirsaman Memaripour
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: