Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1594

Guaranteed way to clear session pool

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

      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 Unassigned
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: