-
Notifications
You must be signed in to change notification settings - Fork 54
Description
We are seeing performance degradation of our services (thread processing gets stuck) and after initial investigation one of the suspect is Clone method of ServiceClient.
I checked the implementation of Clone method and there are two things, which can potentially cause performance/stability issues:
- Sync over async
- Not accepting/honoring cancellation token and creating new one instead when calling DV
Sync over async
Found at least two places, when we do sync over async during Clone operation, this can block whole thread, which can lead to thread pool starvation.
Not honoring cancellation token
Also there are places, which don't accept cancellation tokens when calling external service. This can lead to stuck requests and blocking calling thread.
Here is one of multiple examples:
resp = (WhoAmIResponse)(await Command_WebAPIProcess_ExecuteAsync(
req, null, false, null, Guid.Empty, false, _configuration.Value.MaxRetryCount, _configuration.Value.RetryPauseTime, new CancellationToken(), inLoginFlow:true).ConfigureAwait(false));
Would be possible to create CloneAsync(CancellationToken ct), which would be fully async and honor passed cancellation token?
We use v1.1.16