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

Handle Errno::ECONNREFUSED exceptions

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible

      I've noticed a few Errno::ECONNREFUSED exceptions being raised when a deployment is unreachable.

      I think this should be handled by the driver and raise its own Mongo::Error subclass for easier rescue.

      Stacktrace:

      lib/mongo/socket/tcp.rb:46:in `connect': Connection refused - connect(2) for <redacted> (Errno::ECONNREFUSED)
        from lib/mongo/socket/tcp.rb:46:in `block in connect!'
        from /usr/local/rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
        from /usr/local/rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `call'
        from /usr/local/rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
        from lib/mongo/socket/tcp.rb:44:in `connect!'
        from lib/mongo/server/connection.rb:62:in `connect!'
        from lib/mongo/server/connectable.rb:93:in `ensure_connected'
        from lib/mongo/server/connection.rb:130:in `write'
        from lib/mongo/server/connectable.rb:66:in `block in dispatch'
        from lib/mongo/loggable.rb:44:in `log'
        from lib/mongo/loggable.rb:65:in `log_debug'
        from lib/mongo/server/connectable.rb:65:in `dispatch'
        from lib/mongo/operation/read/query.rb:61:in `block in execute_message'
        from lib/mongo/server/connection_pool.rb:99:in `with_connection'
        from lib/mongo/server/context.rb:63:in `with_connection'
        from lib/mongo/operation/read/query.rb:60:in `execute_message'
        from lib/mongo/operation/read/query.rb:54:in `execute'
        from lib/mongo/collection/view.rb:163:in `send_initial_query'
        from lib/mongo/collection/view/iterable.rb:39:in `each'
        <cropped application code>
      

            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: