Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1927

SDK does not work with publically addressable Kubernetes cluster

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Critical
    • 2.7.9
    • 2.7.6
    • library
    • None
    • 1

    Description

      Similar to GOCBC-431 and JVMCBC-654.

      The .NET SDK does not work with publically addressable Kubernetes clusters.

      The first problem is that it tries to resolve the hostname in the config, even if that's not possible (due to not having access to the appropriate DNS):

      Couchbase.Configuration.Server.Serialization.BootstrapException
        HResult=0x80131500
        Message=Could not bootstrap - check inner exceptions for details.
        Source=Couchbase.NetClient
        StackTrace:
         at Couchbase.Core.ClusterController.CreateBucketImpl(String bucketName, String password, IAuthenticator authenticator)
         at Couchbase.Core.ClusterController.CreateBucket(String bucketName, String password, IAuthenticator authenticator)
         at Couchbase.Cluster.OpenBucket(String bucketName, String password)
         at Couchbase.Cluster.OpenBucket(String bucketname)
         at AltAddress.Program.Main(String[] args) in C:\Users\Administrator\source\repos\AltAddress\AltAddress\Program.cs:line 27
       
      Inner Exception 1:
      TargetInvocationException: Exception has been thrown by the target of an invocation.
       
      Inner Exception 2:
      UnsupportedAddressFamilyException: http://cb-example-0000.cb-example.default.svc
      

      If I add duff entries into the hosts file then it gets past this error and seems to bootstrap correctly, however operations will randomly fail.

      Looking at why this is in the logs, it seems that the node locator is not being initialized correctly:

      19-04-16 15:26:09,192 [1] TRACE Couchbase.Configuration.ConfigContextBase - Getting KeyMapper for rev#109 on thread 1
      2019-04-16 15:26:09,192 [1] TRACE Couchbase.Core.Buckets.VBucketKeyMapper - Using index 77 for key Test - rev109
      2019-04-16 15:26:09,192 [1] DEBUG Couchbase.Core.VBucket - System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
         at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
         at Couchbase.Core.VBucket.LocatePrimary()
      2019-04-16 15:26:09,193 [1] DEBUG Couchbase.Core.VBucket - System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
         at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
         at Couchbase.Core.VBucket.LocatePrimary()
      

      The reason that it works sometimes is because if the vbucket locator can't find the node it needs in the vbucket map, it picks a random one - https://github.com/couchbase/couchbase-net-client/blob/2.7.6/Src/Couchbase/Core/VBucket.cs#L73.
      So if it happens to pick the 'right' node then the operation will succeed, otherwise it will fail.

      Attachments

        Issue Links

          For Gerrit Dashboard: NCBC-1927
          # Subject Branch Project Status CR V

          Activity

            People

              mike.goldsmith Michael Goldsmith
              matt.carabine Matt Carabine (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty