Skip to content

Implement CloneAsync  #447

@tovyhnal

Description

@tovyhnal

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.

-WhoAmIResponse resp = Task.Run(async () => await _connectionSvc.GetWhoAmIDetails(this).ConfigureAwait(false)).ConfigureAwait(false).GetAwaiter().GetResult();

-RefreshInstanceDetails(svc, _targetInstanceUriToConnectTo).ConfigureAwait(false).GetAwaiter().GetResult();

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions