Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-261

Connect object does not try the second IP address when the first one fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0-dp2
    • Component/s: library
    • Security Level: Public
    • Environment:
      python-2.7.5.amd64
      couchbase-1.0.0.win-adm64-py2.7.exe
      Windows 2008 rc2

      Description

      The connect object throws an error and does not try the 2nd hostname/ip in the list.
      Can reproduce with a 2 line script.

      cb1 is up.
      cb2 is shutdown

      This fails:
      from couchbase import Couchbase
      cb = Couchbase.connect(host= ['cb2','cb1'], bucket='Jimmy')

      This works:
      from couchbase import Couchbase
      cb = Couchbase.connect(host= ['cb1','cb2'], bucket='Jimmy')

      Error message:
      Traceback (most recent call last):
      File "cb.py", line 2, in <module>
      cb = Couchbase.connect(host= ['cb2','cb1'], bucket='Jimmy')
      File "C:\Python27\lib\site-packages\couchbase_init_.py", line 212, in conne
      ct
      **kwargs)
      File "C:\Python27\lib\site-packages\couchbase\connection.py", line 88, in __in
      it__
      super(Connection, self)._init_(**kwargs)
      couchbase.exceptions.ConnectError: <RC=0x18[Connection failure], There was a pro
      blem while trying to send/receive your request over the network. This may be a r
      esult of a bad network or a misconfigured client or server., C Source=(src\conne
      ction.c,537)>

      I tried swapping the libcouchbase.dll shipped with the python client with the 2.1.2 version. The result was the same.

      Expectation:
      For the client to throw a warning and try the 2nd, 3rd, etc IP/hostname in the list and to only error once all IP addresses fail.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

          Hide
          avsej Sergey Avseyev added a comment -

          Okay

          Show
          avsej Sergey Avseyev added a comment - Okay
          Hide
          pvarley Patrick Varley added a comment -

          I just tried this on linux and it connects no matter of the order.
          In the second case where cb2 is first it took a bit longer but that is expected.

          Show
          pvarley Patrick Varley added a comment - I just tried this on linux and it connects no matter of the order. In the second case where cb2 is first it took a bit longer but that is expected.
          Hide
          mnunberg Mark Nunberg (Inactive) added a comment -

          Is this still valid? I can try and verify this against the latest release

          Show
          mnunberg Mark Nunberg (Inactive) added a comment - Is this still valid? I can try and verify this against the latest release
          Hide
          mnunberg Mark Nunberg (Inactive) added a comment -

          I guess this would largely depend on the kind of connection error you're getting and how long the system retries for ARP replies if the host is indeed not down. I have just tried this on windows and it times out – you can of course raise the timeout level – eventually the OS will realize that the host is down and forward this back to the client. Since this is originally a python bug, I'll file another one in its place to allow for setting the bootstrap timeout in the constructor. Otherwise there's not much else that can be done about this, as it's expected behavior.

          Show
          mnunberg Mark Nunberg (Inactive) added a comment - I guess this would largely depend on the kind of connection error you're getting and how long the system retries for ARP replies if the host is indeed not down. I have just tried this on windows and it times out – you can of course raise the timeout level – eventually the OS will realize that the host is down and forward this back to the client. Since this is originally a python bug, I'll file another one in its place to allow for setting the bootstrap timeout in the constructor. Otherwise there's not much else that can be done about this, as it's expected behavior.
          Hide
          mnunberg Mark Nunberg (Inactive) added a comment -

          I have verified this running 'cbc' in multiple combinations, it all follows expected behavior

          Show
          mnunberg Mark Nunberg (Inactive) added a comment - I have verified this running 'cbc' in multiple combinations, it all follows expected behavior

            People

            • Assignee:
              mnunberg Mark Nunberg (Inactive)
              Reporter:
              pvarley Patrick Varley
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.