Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-61192

Session cancellation should interrupt blocking I/O

    • ALL
    • Service Arch 2022-2-07, Service Arch 2022-2-21, Service Arch 2022-03-07, Service Arch 2022-03-21
    • 6

      Session exposes the interface to schedule network operations on its underlying networking socket. For each operation, there are both synchronous and asynchronous variants:

      virtual StatusWith<Message> sourceMessage() noexcept = 0;
      virtual Future<Message> asyncSourceMessage(const BatonHandle& handle = nullptr) noexcept = 0;
      
      virtual Status waitForData() noexcept = 0;
      virtual Future<void> asyncWaitForData() noexcept = 0;
      
      virtual Status sinkMessage(Message message) noexcept = 0;
      virtual Future<void> asyncSinkMessage(Message message, const BatonHandle& handle = nullptr) noexcept = 0;
      

      Currently, instances of Session do not keep track of operations scheduled on their underlying sockets. As a result, they cannot await completion or ask for interruption of these operations.

      This ticket should provide the means to account for in-flight operations and demand/await their interruption as part of ending the session.

      virtual void cancelAsyncOperations(const BatonHandle& handle = nullptr) = 0;
      

      As an example, this ticket should provide the means to account for and cancel an asynchronous read operation blocked in the following continuation (e.g., using a fail-point):

      return read(asio::buffer(ptr, kHeaderSize), baton).then([headerBuffer = std::move(headerBuffer), this, baton]() mutable {
          ...
      });
      

      Expected outcome:
      This ticket should provide unit-tests that mimic hangs in the underlying networking layer, and verify the cancelation behavior (i.e., Session::cancelAsyncOperations()) works in presence and absence of networking batons. Furthermore, we should ensure the baton is not running anything on behalf of the session after the session is canceled.

            Assignee:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Reporter:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: