Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Won't Fix
-
None
-
None
-
Service Arch
-
ALL
Description
When ending a session (i.e., an instance of transport::Session), we should ensure it awaits completion of any inflight operations on the networking baton, and then safely removes itself from the baton. Currently, this is not the case:
bool TransportLayerASIO::BatonASIO::cancelSession(Session& session) noexcept override { |
const auto id = session.id(); |
stdx::unique_lock lk(_mutex);
|
if (_sessions.find(id) == _sessions.end()) { |
return false; |
}
|
|
_safeExecute(std::move(lk), [ id, this ](stdx::unique_lock<Mutex> lk) noexcept { |
auto iter = _sessions.find(id);
|
if (iter == _sessions.end()) { |
return; |
}
|
auto session = std::exchange(iter->second, {});
|
_sessions.erase(iter);
|
lk.unlock();
|
|
session.promise.setError(kCanceled);
|
});
|
return true; |
}
|
Since the baton uses the reactor thread to poll on the sessions, we should ensure the baton is not running anything on behalf of the session before removing it.
Attachments
Issue Links
- related to
-
SERVER-47229 Make TransportSessionASIO cancelation level triggered
-
- Closed
-