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

Connecting with read: {mode: :primary_preferred} to a replica set with an unreachable server throws a unhandled (by the gem) expection

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.3
    • Affects Version/s: 2.0.2
    • Component/s: Replica Set
    • None

      I'm attempting a buildInfo: 1 command on a replica set (I'm specifying two members when connecting) and I get:

      NoMethodError: private method `select' called for nil:NilClass
        from [...]/lib/mongo/server_selector/selectable.rb:138:in `primary'
        from [...]/lib/mongo/server_selector/primary_preferred.rb:89:in `select'
        from [...]/lib/mongo/server_selector/selectable.rb:94:in `select_server'
        from [...]/lib/mongo/database.rb:130:in `command'
      

      I would expect :primary_preferred to use the secondary when the primary fails. This just times out after the specified :socket_timeout.

      In any case, it should at least return an error I can handle more gracefully (one that inherits Mongo::Error)

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            jeromegn Jerome Gravel-Niquet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: