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

Move AsioSession ingress initialization steps before startSession

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            james.bronsted@mongodb.com James Bronsted
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: