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

Enforce timeout on socket closes

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.15.0.alpha
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Socket closes are now limited to 5 seconds. Sockets are abandoned if their closes take longer.
    • Minor Change

      It appears that sometimes the socket close call can take a long time:

      
      [2020-12-04 00:32:24.034]   1) Cmap must be able to start a pool with minPoolSize connections (pool-create-min-size.yml) emits correct event 1
      [2020-12-04 00:32:24.034]      Failure/Error:
      [2020-12-04 00:32:24.034]        @lock.synchronize do
      [2020-12-04 00:32:24.034]          # If stop_populator is called while populate is running, there may be
      [2020-12-04 00:32:24.034]          # connections waiting to be connected, connections which have not yet
      [2020-12-04 00:32:24.034]          # been moved to available_connections, or connections moved to available_connections
      [2020-12-04 00:32:24.034]          # but not deleted from pending_connections. These should be cleaned up.
      [2020-12-04 00:32:24.034]          until @pending_connections.empty?
      [2020-12-04 00:32:24.034]            connection = @pending_connections.take(1).first
      [2020-12-04 00:32:24.034]            connection.disconnect!
      [2020-12-04 00:32:24.034]            @pending_connections.delete(connection)
      [2020-12-04 00:32:24.034]          end
      [2020-12-04 00:32:24.034]      
      [2020-12-04 00:32:24.034]      Timeout::Error:
      [2020-12-04 00:32:24.034]        execution expired
      [2020-12-04 00:32:24.034]      # ./lib/mongo/server/connection_pool.rb:634:in `stop_populator'
      [2020-12-04 00:32:24.034]      # ./lib/mongo/server/connection_pool.rb:485:in `clear'
      [2020-12-04 00:32:24.034]      # ./lib/mongo/server.rb:262:in `disconnect!'
      [2020-12-04 00:32:24.034]      # ./spec/support/common_shortcuts.rb:262:in `block in register_server'
      [2020-12-04 00:32:24.034]      # ./spec/support/local_resource_registry.rb:27:in `block in close_all'
      [2020-12-04 00:32:24.034]      # ./spec/support/local_resource_registry.rb:23:in `close_all'
      [2020-12-04 00:32:24.034]      # ./spec/spec_helper.rb:28:in `block in /data/mci/b2feb6dc7e6e6394dd74e6733db05092/src/spec/spec_helper.rb'
      [2020-12-04 00:32:24.034]      # ./spec/lite_spec_helper.rb:122:in `block in /data/mci/b2feb6dc7e6e6394dd74e6733db05092/src/spec/lite_spec_helper.rb'
      [2020-12-04 00:32:24.034]      # ./spec/lite_spec_helper.rb:121:in `block in /data/mci/b2feb6dc7e6e6394dd74e6733db05092/src/spec/lite_spec_helper.rb'
      [2020-12-04 00:32:24.034]      # ./spec/lite_spec_helper.rb:104:in `block in /data/mci/b2feb6dc7e6e6394dd74e6733db05092/src/spec/lite_spec_helper.rb'
      [2020-12-04 00:32:24.034]      # ./spec/support/background_thread_registry.rb:62:in `block in /data/mci/b2feb6dc7e6e6394dd74e6733db05092/src/spec/support/background_thread_registry.rb'
      

      Since we ignore errors when closing sockets (i.e. if the close fails we discard the socket), the same behavior can be extended to when the closes take too long.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: