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

MongoClient.active? raises an error

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.12
    • Affects Version/s: 1.9.2
    • Component/s: Public API
    • None
    • Environment:
      linux, fedora 20
      Linux localhost.localdomain 3.16.3-200.fc20.x86_64 #1 SMP Wed Sep 17 22:34:21 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

      If I set an `:op_timeout` value and then I firewall the database, then first call to `MongoClient.active?` raises an error. IMO it makes sense for this method to never throw but return `false`.

      [84] pry(#<Object>)> db.active?
      Mongo::OperationTimeout: Timed out waiting on socket read.
      from /usr/local/share/gems/gems/mongo-1.9.2/lib/mongo/networking.rb:321:in `rescue in receive_message_on_socket'
      

      Also I think that this method should not block indefinitely if database is firewalled/inaccessible and `:op_timeout` is `nil`. Otherwise this method becomes useless for any practical purposes. In my opinion it should just return true or false whenever database is accessible or not accessible.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            akostadinov Aleksandar Kostadinov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: