NRE GetDocumentFromReplicaAsync when EndPoint is null v3.2.X

Description

From forums: https://forums.couchbase.com/t/net-v3-2-x-sdk-usage-of-getanyreplicaasync/32673

We’re upgrading to the 3.2.x SDK and encountered an issue with the GetAnyReplicaAsync method (I didn’t check GetAllReplicaAsync).

So this throws ArgumentNullExceptionevery time it’s called after auto-failover event. This is the stack trace:

\nStackTrace:\nInner Exception:\n\nValue cannot be null. (Parameter ‘endPoint’)\nType: System.ArgumentNullException\nSource: Couchbase.NetClient\nTargetSite: Void ThrowArgumentNullException(System.String)\nStackTrace:\n at Couchbase.Utils.ThrowHelper.ThrowArgumentNullException(String paramName)\n at Couchbase.CouchbaseBucket.SendAsync(IOperation op, CancellationTokenPair tokenPair)\n at Couchbase.Core.Retry.RetryOrchestrator.RetryAsync(BucketBase bucket, IOperation operation, CancellationTokenPair tokenPair)\n at Couchbase.KeyValue.CouchbaseCollection.GetReplica(String id, Int16 index, IRequestSpan span, CancellationToken cancellationToken, ITranscoderOverrideOptions options)\n at Couchbase.KeyValue.CouchbaseCollection.GetAnyReplicaAsync(String id, GetAnyReplicaOptions options)\n

Note this doesn’t occur before auto-failover, only after this. I think this is very similar to the related issue in the v2.7.x SDK .net 2.7.X NullReferenceException encountered on GetDocumentFromReplicaAsync<T>

Environment

None

Gerrit Reviews

None

Release Notes Description

None

Attachments

2

Activity

Show:

Eugene Shcherbo February 8, 2022 at 8:38 PM

thank you

Jeffry Morris February 7, 2022 at 8:19 PM

 

If for any reason we cannot map to a node, then we throw a NodeUnavailableException which puts the operation into the retry loop. The operation should then either succeed or continue to retry until it times out. The problem was that the NullArgumentException was being thrown because the endpoint was null and it was percolating up to the app layer.

You can see the proposed change on the Gerrit link on the right side of this ticket.

Jeff

Eugene Shcherbo February 7, 2022 at 12:19 PM
Edited

Hello  

I tested with your updates and can confirm that the ArgumentNullException exception disappeared, so your fix seems to be the right one. Thank you very much for taking a look at this.

Out of curiosity, could you please tell/show me what you changed (probably you have a git branch published?).

Jeffry Morris February 6, 2022 at 4:24 AM
Edited

 

I still haven't replicated but based on the stacktrace, I am pretty sure I have a fix. I attached a VF (

), please provide any feedback on how it works out.

Note that this has not been thoroughly tested and or vetted by our QE, so use it for verification purposes only.

Jeff

Jeffry Morris February 1, 2022 at 9:18 PM

Thanks , I'll take a look!

 

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created January 19, 2022 at 5:23 PM
Updated February 8, 2022 at 8:38 PM
Resolved February 7, 2022 at 10:51 PM
Instabug