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

Some URI options are not usable due to value conversion to Symbol

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.9.0.rc0
    • Affects Version/s: None
    • Component/s: None
    • None

      It appears that the driver converts all string values to symbols by default, in particular making tlscafile option not work:

      speed% MONGODB_URI="mongodb://localhost:27017,/a?tls=true&tlsCAFile=`pwd`/spec/support/certificates/ca.pem" rake spec:config
      The dependency jruby-openssl (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for java. To add those platforms to the bundle, run `bundle lock --add-platform java`.
      The dependency json (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for java. To add those platforms to the bundle, run `bundle lock --add-platform java`.
      {}
      #<Mongo::URI:0x000056019906b878 @string="mongodb://localhost:27017,/a?tls=true&tlsCAFile=/home/w/apps/ruby-driver/spec/support/certificates/ca.pem", @options={}, @servers=["localhost:27017"], @user=nil, @password=nil, @uri_options={"ssl"=>true, "ssl_ca_cert"=>:"/home/w/apps/ruby-driver/spec/support/certificates/ca.pem"}, @database="a">
      "mongodb://localhost:27017,/a?tls=true&tlsCAFile=/home/w/apps/ruby-driver/spec/support/certificates/ca.pem"
      {"ssl"=>true, "ssl_ca_cert"=>:"/home/w/apps/ruby-driver/spec/support/certificates/ca.pem"}
      D, [2019-03-03T20:16:06.341879 #3781] DEBUG -- : MONGODB | EVENT: #<TopologyOpening topology=Unknown[]>
      D, [2019-03-03T20:16:06.341914 #3781] DEBUG -- : MONGODB | Topology type 'unknown' initializing.
      D, [2019-03-03T20:16:06.342037 #3781] DEBUG -- : MONGODB | EVENT: #<TopologyChanged prev=Unknown[] new=Unknown[localhost:27017]>
      D, [2019-03-03T20:16:06.342056 #3781] DEBUG -- : MONGODB | Topology type 'Unknown' changed to type 'Unknown'.
      D, [2019-03-03T20:16:06.342076 #3781] DEBUG -- : MONGODB | EVENT: #<ServerOpening address=localhost:27017 topology=Unknown[localhost:27017]>
      D, [2019-03-03T20:16:06.342089 #3781] DEBUG -- : MONGODB | Server localhost:27017 initializing.
      D, [2019-03-03T20:16:06.343754 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:06.843021 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:07.343122 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:07.843187 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:08.343316 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:08.843379 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:09.343539 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:09.843656 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:10.343821 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:10.843904 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      D, [2019-03-03T20:16:11.344067 #3781] DEBUG -- : MONGODB | Error running ismaster on localhost:27017: no implicit conversion of Symbol into String
      rake aborted!
      Mongo::Error::NoServerAvailable: No primary server is available in cluster: #<Cluster topology=Unknown[localhost:27017] servers=[#<Server address=localhost:27017 UNKNOWN>]> with timeout=5, LT=0.015
      /home/w/apps/ruby-driver/lib/mongo/server_selector/selectable.rb:184:in `select_server'
      /home/w/apps/ruby-driver/lib/mongo/cluster.rb:520:in `next_primary'
      /home/w/apps/ruby-driver/spec/support/spec_config.rb:55:in `initialize'
      /home/w/apps/ruby-driver/Rakefile:43:in `block (2 levels) in <top (required)>'
      Tasks: TOP => spec:config
      (See full trace by running task with --trace)
      

      Only some of the URI options should be converted to symbols, the others must be left as strings.

            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: