Do not execute endSessions during MongoClient.close() against servers that do not support sessions

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Sessions
    • 2
    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a driver engineer,
      I want do not want to execute endSessions against mongods and mongod-likes that do not support sessions,
      So that I do not waste time executing operations that always fail.

      This is primarily an issue when executing MongoClient.close() against mongocryptd.  Every operation executes with a session, so the driver creates sessions, but if the connection doesn't support sessions, a session is never attached to commands executed against it.  This leads to the following scenario in MongoClient.close():

      • We always have sessions to cleanup driver-side but the driver always assumes any session needs to be cleaned up server side.
      • Sessions are not supported on the mongocryptd, so `endSessions` always fails.
      • We ignore the response, so we've never considered this scenario before because errors are suppressed.

      mongocryptd <5.0 hangs (and becomes an unkillable process on macOS) if an endSessions with moreToCome: true is sent (as is the case after https://jira.mongodb.org/browse/NODE-6377 is completed).  Regardless of server behaviors here, MongoClient.close() should probably not be attempting to execute endSessions where this command will always fail.

      User Experience

      • Just a slightly slightly slower than necessary MongoClient.close().

      Dependencies

      • n/a

      Risks/Unknowns

      • n/a

      Acceptance Criteria

      Implementation Requirements

      • Do not execute endSessions in MongoClient.close() if sessions are not supported.

      Testing Requirements

      • Follow the pattern of sessions prose tests 18 and 19, which test environments where sessions are not supported, and assert that when MongoClient.close() is executed, no endSessions is executed.

      Documentation Requirements

      • n/a

      Follow Up Requirements

      • n/a

            Assignee:
            Bailey Pearson
            Reporter:
            Bailey Pearson
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: