-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Networking & Observability
Currently, `CommonAsioSession` performs a few initialization steps in ingress mode, some of which occur before the `startSession` is invoked on the session and some of which occur after. For example, parsing the proxy protocol header occurs before `startSession`, while the SSL handshake occurs during the first read, which occurs after `startSession`.
This inconsistency means that ingress sessions that have "started," and therefore are accessible by multiple threads, aren't fully initialized, which makes it potentially difficult to reason about what state a session may be in. The thread-safety issue documented in SERVER-72605 occurs because the SSL handshake can occur concurrently to the session being terminated; if the SSL handshake occurs before the session becomes available to threads other than its owner, there is no such concurrent behavior to consider.
Move all of ingress initialization steps to occur before `startSession`. An example of how this might be implemented can be found among these code snippets:
Additionally, when the SSL handshake is moved to occur before session start, also remove the synchronization logic added in SERVER-72605.
- is related to
-
SERVER-72605 Ensure and document thread-safety semantics for `Session::end()`
- Closed