Hi guys,
I’m receiving the same Couchbase.Core.Exceptions.UnambiguousTimeoutException exception with the same operation id value and timeout time e.g. "The operation 2903/ timed out after 00:00:02.9647126. It was retried 0 times using Couchbase.Core.Retry.BestEffortRetryStrategy " for different requests performed on the same collection.
The distribution period of those exceptions is 20 minutes on the same Pod (All the requests).
The strange thing is that we receive the exception immediately after the call (seems that the call isn’t executed at all)
The collection has been retrieved as a single instance object on which I use the method GetAsync(key).Result (Synchronous way)
The Sdk version is 3.3.5
Could you help me to understand what i’m doing wrong ?
Regards
Federico
My first guess is that the problem may relate to your use of the “synchronous way”. This is an anti-pattern that should, in my opinion, never be done. It is known to cause things like deadlocks, thread pool depletion, and more. This is not a Couchbase-specific issue, but an issue with .NET in general. You should never call .Wait()
on a task and never call .Result
or .GetAwaiter().GetResult()
unless you are sure the task is already complete via some other await mechanism.
Your best bet is to make your code properly asynchronous. However, that isn’t always feasible for a variety of reasons. If you MUST execute synchronously then you should use a “safe” mechanism. While it doesn’t prevent thread pool depletion it does prevent deadlocks and some other problem cases.
I created this NuGet package that provides such a mechanism you may use: GitHub - CenterEdge/CenterEdge.Async: When you gotta, you gotta. It is available on a public NuGet feed from GitHub or you can copy the source code.