NullRefereceException inside Couchbase client 3.0 during connection

I am working on migration from .NET SDK 2.7 to .NET SDK 3.0. Couchbase server 6.0. This code throws NullRefereceException. I can’t understand what I am doing wrong.

var options = new ClusterOptions()
    .WithConnectionString("http://192.168.1.120:8091") //Node's IP
    .WithCredentials("User", "Password")
    .WithBuckets("SomeBucket");
var cluster = await Cluster.ConnectAsync(options);

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Couchbase.NetClient
  StackTrace:
   at Couchbase.Core.ClusterNode.<ExecuteOp>d__112.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.ClusterNode.<Hello>d__104.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.ClusterNode.<Couchbase-Core-IO-Connections-IConnectionInitializer-InitializeConnectionAsync>d__117.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.<CreateConnectionAsync>d__19.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass28_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<AddConnectionsAsync>d__28.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<InitializeAsync>d__21.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.ClusterNode.<InitializeAsync>d__102.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Core.DI.ClusterNodeFactory.<CreateAndConnectAsync>d__9.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Couchbase.Core.ClusterContext.<BootstrapGlobalAsync>d__49.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Cluster.<Couchbase-Core-Bootstrapping-IBootstrappable-BootStrapAsync>d__42.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Couchbase.Cluster.<ConnectAsync>d__22.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at ConsoleApp1.CouchbaseTesting.<Test>d__0.MoveNext() in C:\Users\Ivant\source\repos\ConsoleApp1\ConsoleApp1\CouchbaseTesting.cs:line 18

  This exception was originally thrown at this call stack:
    [External Code]
    ConsoleApp1.CouchbaseTesting.Test() in CouchbaseTesting.cs

Did you try passing the connection string without the port ?

.WithConnectionString(“http://192.168.1.120”)

1 Like

@Ramirag -

If your not on v3.0.2 of the client , can you please upgrade to that version and see it resolves the issue? Let us know if it does!

-Jeff

1 Like

I have tested it without port on 3.0. It sounds funny, but it helped a little. I get connection. But cluster.Buckets.GetAllBucketsAsync() fails with

System.ArgumentNullException
  HResult=0x80004003
  Message=Value cannot be null. (Parameter 'uri')
  Source=System.Private.Uri
  StackTrace:
   at System.UriBuilder..ctor(Uri uri)
   at Couchbase.Management.Buckets.BucketManager.GetUri(String bucketName)
   at Couchbase.Management.Buckets.BucketManager.<GetAllBucketsAsync>d__12.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at ConsoleApp1.CouchbaseTesting.<Test>d__0.MoveNext() in C:\Users\Ivant\source\repos\ConsoleApp1\ConsoleApp1\CouchbaseTesting.cs:line 22

  This exception was originally thrown at this call stack:
    [External Code]
    ConsoleApp1.CouchbaseTesting.Test() in CouchbaseTesting.cs

and collection.InsertAsync(“testKey1q2w3e4r5t6y”, “testValue”, insertOptions => insertOptions.Expiry(TimeSpan.FromMinutes(10))) fails with

System.AggregateException
  HResult=0x80131500
  Message=Bootstrapping for bucket AtomicSearchCache as failed. (Cannot resolve DNS for test-cb02.avionero.net.)
  Source=Couchbase.NetClient
  StackTrace:
   at Couchbase.Core.BucketBase.ThrowIfBootStrapFailed()
   at Couchbase.KeyValue.CouchbaseCollection.<InsertAsync>d__26`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at ConsoleApp1.CouchbaseTesting.<Test>d__0.MoveNext() in C:\Users\Ivant\source\repos\ConsoleApp1\ConsoleApp1\CouchbaseTesting.cs:line 42

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
InvalidArgumentException: Cannot resolve DNS for test-cb02.avionero.net.

On 3.1 and 3.2 collection.InsertAsync(“testKey1q2w3e4r5t6y”, “testValue”, insertOptions => insertOptions.Expiry(TimeSpan.FromMinutes(10))) works

On 3.0.2 with port I get connection. But cluster.Buckets.GetAllBucketsAsync() fails with

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Couchbase.NetClient
  StackTrace:
   at Couchbase.Core.ServiceUriProvider.GetRandomManagementUri()
   at Couchbase.Management.Buckets.BucketManager.GetUri(String bucketName)
   at Couchbase.Management.Buckets.BucketManager.<GetAllBucketsAsync>d__12.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at ConsoleApp1.CouchbaseTesting.<Test>d__0.MoveNext() in C:\Users\Ivant\source\repos\ConsoleApp1\ConsoleApp1\CouchbaseTesting.cs:line 22

  This exception was originally thrown at this call stack:
    [External Code]
    ConsoleApp1.CouchbaseTesting.Test() in CouchbaseTesting.cs

and cluster.BucketAsync(“AtomicSearchCache”); fails with

Couchbase.Management.Buckets.BucketNotFoundException
  HResult=0x80131500
  Message=Bucket with name AtomicSearchCache does not exist
  Source=Couchbase.NetClient
  StackTrace:
   at Couchbase.Core.ClusterContext.<GetOrCreateBucketAsync>d__51.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult()
   at Couchbase.Cluster.<>c__DisplayClass25_0.<<BucketAsync>b__0>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
   at ConsoleApp1.CouchbaseTesting.<Test>d__0.MoveNext() in C:\Users\Ivant\source\repos\ConsoleApp1\ConsoleApp1\CouchbaseTesting.cs:line 40

  This exception was originally thrown at this call stack:
    [External Code]
    ConsoleApp1.CouchbaseTesting.Test() in CouchbaseTesting.cs

@Ramirag -

I’ll look into the first issue cluster.Buckets.GetAllBucketsAsync() ; the second issue sounds like perhaps the cluster you are connecting to does not have that bucket (“AtomicSearchCache”)? Note that the two calls are distinctly different:

  • cluster.Buckets.GetAllBucketsAsync() will return a dictionary of bucket names and BucketSettings objects; its a management API call.
  • cluster.BucketAsync(“AtomicSearchCache”) will return an IBucket implementation for performing K/V using scopes and collections.

I am curious, what type of bucket is AtomicSearchCache?

Thanks,
Jeff

No, this bucket is exist. I can connect to it without port. Look my answer to @AV25242.

cluster.Buckets.GetAllBucketsAsync() I called it just for fun. I don’t need at work :slight_smile:

Damn, I forgot to remove company data :slight_smile: There are an airline tickets for very simple(atomic) requests.

Update
Or did u ask data type? It’s JSON.

@Ramirag -

It didn’t resolve DNS: Cannot resolve DNS for test-cb02.avionero.net

Can you provide the following information:

  • Describe the environment (cloud, docker, localhost, etc)?
  • Can you enable logging and post the results: something like this
            //Install-Package Serilog.Extensions.Logging.File -Version 2.0.0

            IServiceCollection serviceCollection = new ServiceCollection();
            serviceCollection.AddLogging(builder => builder
                .AddFilter(level => level >= LogLevel.Debug)
            );
            var loggerFactory = serviceCollection.BuildServiceProvider().GetService<ILoggerFactory>();
            loggerFactory.AddFile("Logs/myapp-{Date}.txt", LogLevel.Debug);

Note that the SDK will try DNS first and then if it cannot resolve, log that it cannot connect using DNS and then move on to hostname resolution. This is expected and you’ll see it in the logs.

-Jeff

I use a console app and connect to Couchbase thought VPN. About server I can’t say anything, but all works on SDK 2.7 with port.

2020-06-20T00:08:15.0910020+03:00  [DBG] Bootstrapping with node "192.168.1.120" (98ca0e33)
2020-06-20T00:08:15.2618440+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:15.2618439+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:15.2816599+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:15.2818617+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:15.4645288+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000001\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 3. (ebdc59ba)
2020-06-20T00:08:15.4645234+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000002\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 4. (ebdc59ba)
2020-06-20T00:08:17.9765313+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000002\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:17.9765313+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000001\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:18.0203175+03:00  [DBG] Error encountered bootstrapping cluster; if the cluster is 6.5 or earlier, this can be ignored. "System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Couchbase.Core.ClusterNode.ExecuteOp(Action`3 sender, IOperation op, Object state, CancellationToken token, Nullable`1 timeout)
   at Couchbase.Core.ClusterNode.Hello(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.Couchbase.Core.IO.Connections.IConnectionInitializer.InitializeConnectionAsync(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass28_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpoint endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.BootstrapGlobalAsync()
   at Couchbase.Cluster.Couchbase.Core.Bootstrapping.IBootstrappable.BootStrapAsync()". (ba6fd600)
2020-06-20T00:08:18.1070995+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:18.1072854+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:18.1075981+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000003\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 6. (ebdc59ba)
2020-06-20T00:08:18.1178018+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:18.1179569+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:18.1181311+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000004\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 8. (ebdc59ba)
2020-06-20T00:08:20.6083771+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000003\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:20.6311004+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000004\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:20.6343093+03:00  [INF] Cannot bootstrap bucket "AtomicSearchCache" as Couchbase. (1ecb21a9)
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Couchbase.Core.ClusterNode.ExecuteOp(Action`3 sender, IOperation op, Object state, CancellationToken token, Nullable`1 timeout)
   at Couchbase.Core.ClusterNode.Hello(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.Couchbase.Core.IO.Connections.IConnectionInitializer.InitializeConnectionAsync(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass28_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpoint endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.CreateAndBootStrapBucketAsync(String name, HostEndpoint endpoint, BucketType type)
   at Couchbase.Core.ClusterContext.GetOrCreateBucketAsync(String name)
2020-06-20T00:08:20.7645506+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:20.7646071+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:20.7647420+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:20.7647422+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:20.7653749+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000005\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 11. (ebdc59ba)
2020-06-20T00:08:20.7653749+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000006\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 12. (ebdc59ba)
2020-06-20T00:08:23.2665223+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000005\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:23.2665223+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000006\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:23.2684301+03:00  [INF] Cannot bootstrap bucket "AtomicSearchCache" as Memcached. (1ecb21a9)
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Couchbase.Core.ClusterNode.ExecuteOp(Action`3 sender, IOperation op, Object state, CancellationToken token, Nullable`1 timeout)
   at Couchbase.Core.ClusterNode.Hello(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.Couchbase.Core.IO.Connections.IConnectionInitializer.InitializeConnectionAsync(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass28_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpoint endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.CreateAndBootStrapBucketAsync(String name, HostEndpoint endpoint, BucketType type)
   at Couchbase.Core.ClusterContext.GetOrCreateBucketAsync(String name)
2020-06-20T00:08:23.3654539+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:23.3654539+03:00  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-06-20T00:08:23.3658702+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:23.3662523+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000008\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 14. (ebdc59ba)
2020-06-20T00:08:23.3675753+03:00  [DBG] Starting connection initialization on server "192.168.1.120:8091". (5c5836f0)
2020-06-20T00:08:23.3682978+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000007\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 16. (ebdc59ba)
2020-06-20T00:08:25.8765751+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000008\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:25.8766088+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000007\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)
2020-06-20T00:08:25.8782770+03:00  [INF] Cannot bootstrap bucket "AtomicSearchCache" as Ephemeral. (1ecb21a9)
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Couchbase.Core.ClusterNode.ExecuteOp(Action`3 sender, IOperation op, Object state, CancellationToken token, Nullable`1 timeout)
   at Couchbase.Core.ClusterNode.Hello(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.Couchbase.Core.IO.Connections.IConnectionInitializer.InitializeConnectionAsync(IConnection connection, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass28_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpoint endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.CreateAndBootStrapBucketAsync(String name, HostEndpoint endpoint, BucketType type)
   at Couchbase.Core.ClusterContext.GetOrCreateBucketAsync(String name)

@Ramirag -

This is odd, from what I can see you can create the initial socket connection, but the calls to the Couchbase Service specifically time out:

2020-06-20T00:08:15.4645234+03:00  [DBG] Executing op Helo on "192.168.1.120:8091" with key "{\"i\":\"a410cf205bacf4a5/0000000000000002\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" and opaque 4. (ebdc59ba)
2020-06-20T00:08:17.9765313+03:00  [DBG] KV Operation timeout for "{\"i\":\"a410cf205bacf4a5/0000000000000002\",\"a\":\"couchbase-net-sdk/3.0.2.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 10.0.18363)\"}" on server "192.168.1.120:8091". (d607be31)

Helo is the first call to Couchbase server and it times out. Can you try our tool SDK Doctor to help identify the issue? You just need to post the results summary.

I suspect it’s related to the VPN and perhaps a firewall issue?

-Jeff

sdk-doctor-windows.exe diagnose http://192.168.1.120:8091/AtomicSearchCache
Summary:

[33m[WARN][0m Connection string is using the deprecated `http://` scheme.  Use the `couchbase://` scheme instead!
[33m[WARN][0m Your connection string specifies only a single host.  You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
[33m[WARN][0m Bootstrap host `192.168.1.120` is not using the canonical node hostname of `test-cb01.avionero.net`.  This is not neccessarily an error, but has been known to result in strange and challenging to diagnose errors when DNS entries are reconfigured.
[33m[WARN][0m Could not test Search service on `test-cb01.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Analytics service on `test-cb01.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Search service on `test-cb02.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Analytics service on `test-cb02.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Search service on `test-cb03.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Analytics service on `test-cb03.avionero.net` as it was not in the config
[33m[WARN][0m Memcached service on `test-cb01.avionero.net:11210` on average took longer than 10ms (was: 55ms) to reply.  This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb01.avionero.net:11210` maximally took longer than 20ms (was: 93ms) to reply. This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb02.avionero.net:11210` on average took longer than 10ms (was: 55ms) to reply.  This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb02.avionero.net:11210` maximally took longer than 20ms (was: 91ms) to reply. This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb03.avionero.net:11210` on average took longer than 10ms (was: 53ms) to reply.  This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb03.avionero.net:11210` maximally took longer than 20ms (was: 65ms) to reply. This is usually due to network-related issues, and could significantly affect application performance.

sdk-doctor-windows.exe diagnose couchbase://test-cb01.avionero.net,test-cb02.avionero.net,test-cb03.avionero.net/AtomicSearchCache With this connection string code works
Summary:

[33m[WARN][0m Could not test Search service on `test-cb01.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Analytics service on `test-cb01.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Search service on `test-cb02.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Analytics service on `test-cb02.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Search service on `test-cb03.avionero.net` as it was not in the config
[33m[WARN][0m Could not test Analytics service on `test-cb03.avionero.net` as it was not in the config
[33m[WARN][0m Memcached service on `test-cb01.avionero.net:11210` on average took longer than 10ms (was: 53ms) to reply.  This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb01.avionero.net:11210` maximally took longer than 20ms (was: 60ms) to reply. This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb02.avionero.net:11210` on average took longer than 10ms (was: 51ms) to reply.  This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb02.avionero.net:11210` maximally took longer than 20ms (was: 55ms) to reply. This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb03.avionero.net:11210` on average took longer than 10ms (was: 50ms) to reply.  This is usually due to network-related issues, and could significantly affect application performance.
[33m[WARN][0m Memcached service on `test-cb03.avionero.net:11210` maximally took longer than 20ms (was: 51ms) to reply. This is usually due to network-related issues, and could significantly affect application performance.