[SERVER-61192] Session cancellation should interrupt blocking I/O Created: 02/Nov/21  Updated: 04/Mar/22  Resolved: 04/Mar/22

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Amirsaman Memaripour
Resolution: Done Votes: 0
Labels: servicearch-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split to SERVER-64191 Ensure `Session::cancelAsyncOperation... Closed
split to SERVER-64174 Ensure timers/sessions added to `Bato... Closed
Related
related to SERVER-47229 Make TransportSessionASIO cancelation... Closed
related to SERVER-63185 Add unit-tests for the networking baton Closed
is related to SERVER-63282 Refactor and simplify `BatonASIO` Closed
Operating System: ALL
Sprint: Service Arch 2022-2-07, Service Arch 2022-2-21, Service Arch 2022-03-07, Service Arch 2022-03-21
Participants:
Story Points: 6

 Description   

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.



 Comments   
Comment by Amirsaman Memaripour [ 04/Mar/22 ]

Closing as "Done" as this work is now divided into SERVER-64174 and SERVER-64191.

Comment by Githook User [ 04/Mar/22 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-61192 Update TODOs to point to new tickets
Branch: master
https://github.com/mongodb/mongo/commit/26087c5eb715ae8635f1974ca3c4b64d8501d88b

Generated at Thu Feb 08 05:51:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.