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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.0.3
    • Affects Version/s: 2.0.2
    • Component/s: Replica Set
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 (Inactive)
              Reporter:
              Jerome Gravel-Niquet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: