.net 2.7.X NullReferenceException encountered on GetDocumentFromReplicaAsync<T>

Some of our components went into unrecoverable state in terms of Couchbase client connectivity. These components does not have a health probe mechanism, so we have to resolve this issue periodically by restarting them manually.

Exception occurs here in library code:

On first look I see that code doesn’t passing EndPoint information in this method: couchbase-net-client/IOServiceBase.cs at 5a33ff12076ab5ec6be99ed454816652a6c0f1b7 · couchbase/couchbase-net-client · GitHub

Exception stacktrace:

Object reference not set to an instance of an object.
Type: System.NullReferenceException
Source: Couchbase.NetClient
TargetSite: Couchbase.Tracing.OperationContext CreateOperationContext(Couchbase.IO.SocketAsyncState, System.Nullable`1[System.Int64], System.String)
StackTrace:
   at Couchbase.Core.Buckets.CallbackFactory.CreateOperationContext(SocketAsyncState state, Nullable`1 serverDuration, String bucketName)
   at Couchbase.Core.Buckets.CallbackFactory.<>c__DisplayClass7_0`1.<<CompletedFuncForRetry>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.IO.Services.IOServiceBase.HandleException(ExceptionDispatchInfo capturedException, IOperation operation)
   at Couchbase.IO.Services.SharedPooledIOService.ExecuteAsync[T](IOperation`1 operation)
   at Couchbase.Core.Server.SendAsync[T](IOperation`1 operation)
   at Couchbase.Core.Buckets.RequestExecuterBase.ReadFromReplicaAsync[T](ReplicaRead`1 operation)
   at Couchbase.CouchbaseBucket.GetDocumentFromReplicaAsync[T](String id, TimeSpan timeout)
   at Couchbase.CouchbaseBucket.GetDocumentFromReplicaAsync[T](String id, TimeSpan timeout)
   at <our code>

Which specific version are you using? If your not on 2.7.26, can you update to that version and let me know how it goes?

Jeff

We’re using 2.7.26 version of client.

I was hoping you were hitting NCBC-2872, but since you are on 2.7.2, its likely a bug, but I suspect its a side effect of another issue. Enabling logging and analyzing the logs should help identify the root cause.

I created an issue for tracking.

Jeff