Guaranteed way to clear session pool

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: Sessions
    • 1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently the session pool suggests `end_sessions` method as the way of clearing itself, however this method's exception handler can stop execution prior to removing all sessions from the pool:

            def end_sessions
              while !@queue.empty?
                server = ServerSelector.get(mode: :primary_preferred).select_server(@cluster)
                Operation::Command.new(
                    :selector => {endSessions: @queue.shift(10_000).collect { |s| s.session_id }},
                    :db_name => Database::ADMIN).execute(server)
              end
            rescue
            end
      

      If the pool contains more than 10,000 sessions and there is an error removing the first 10,000, subsequent sessions won't be removed. If there is a problem selecting a server no sessions will be removed.

      There should be a way to clear the pool client side even if sessions cannot be killed on the server.

              Assignee:
              Unassigned
              Reporter:
              Oleg Pudeyev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: