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

Connection failure on 2.5.0 when initiating a client with "localhost".

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.0
    • Component/s: None
    • Environment:

      Hi,

      I noticed the following script fails on 2.5.0 (used to work on 2.4.3):

      require 'mongo'                                                                             
      client = Mongo::Client.new([ 'localhost:27017' ], database: 'development')
      puts client.database.collections
      

      Changing "localhost" to "127.0.0.1" works.

      ## Output for 2.5.0
      
      wpp@~/git/sandbox$ bundle exec ruby test.rb
      D, [2018-02-09T13:43:12.702265 #10871] DEBUG -- : MONGODB | Topology type 'unknown' initializing.
      D, [2018-02-09T13:43:12.702458 #10871] DEBUG -- : MONGODB | Server localhost:27017 initializing.
      D, [2018-02-09T13:43:12.704956 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:13.210214 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:13.714324 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:14.217036 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:14.719472 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:15.223425 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:15.728603 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:16.233551 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:16.734265 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:17.237078 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:17.740351 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      D, [2018-02-09T13:43:18.241844 #10871] DEBUG -- : MONGODB | Address family not supported by protocol family - connect(2) for [::1]:27017
      ^C/Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/server/monitor.rb:186:in `sleep': Interrupt
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/server/monitor.rb:186:in `throttle_scan_frequency!'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/server/monitor.rb:75:in `scan!'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/cluster.rb:352:in `block in scan!'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/cluster.rb:352:in `each'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/cluster.rb:352:in `scan!'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/server_selector/selectable.rb:113:in `select_server'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/cluster.rb:246:in `next_primary'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/database/view.rb:53:in `collection_names'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/database.rb:117:in `collection_names'
        from /Users/wpp/.gem/ruby/2.3.3/gems/mongo-2.5.0/lib/mongo/database.rb:141:in `collections'
        from test.rb:5:in `<main>'
      
      ## Output for 2.4.3
      
      wpp@~/git/sandbox$ bundle
      Fetching gem metadata from https://rubygems.org/..........
      Resolving dependencies...
      Using bson 4.3.0
      Using bundler 1.16.0.pre.3
      Using mongo 2.4.3 (was 2.5.0)
      Bundle complete! 1 Gemfile dependency, 3 gems now installed.
      Use `bundle info [gemname]` to see where a bundled gem is installed.
      wpp@~/git/sandbox$ bundle exec ruby test.rb
      D, [2018-02-09T13:43:37.220586 #10906] DEBUG -- : MONGODB | Topology type 'unknown' initializing.
      D, [2018-02-09T13:43:37.220736 #10906] DEBUG -- : MONGODB | Server localhost:27017 initializing.
      D, [2018-02-09T13:43:37.224735 #10906] DEBUG -- : MONGODB | Topology type 'unknown' changed to type 'single'.
      D, [2018-02-09T13:43:37.224817 #10906] DEBUG -- : MONGODB | Server description for localhost:27017 changed from 'unknown' to 'standalone'.
      D, [2018-02-09T13:43:37.224905 #10906] DEBUG -- : MONGODB | There was a change in the members of the 'single' topology.
      D, [2018-02-09T13:43:37.225355 #10906] DEBUG -- : MONGODB | localhost:27017 | eyeson_dev_development.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
      D, [2018-02-09T13:43:37.227828 #10906] DEBUG -- : MONGODB | localhost:27017 | eyeson_dev_development.listCollections | SUCCEEDED | 0.002313s
      #<Mongo::Collection:0x007febbb8962d8>
      #<Mongo::Collection:0x007febbb896288>
      #<Mongo::Collection:0x007febbb896238>
      #<Mongo::Collection:0x007febbb8961e8>
      #<Mongo::Collection:0x007febbb896198>
      #<Mongo::Collection:0x007febbb896148>
      #<Mongo::Collection:0x007febbb8960d0>
      #<Mongo::Collection:0x007febbb896058>
      
      

      Let me know if you need more information,
      have a good weekend.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            wpp Philipp Weißensteiner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: