You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get info about a namespace, using 1.4.0 of the .NET SDK.
Describe the bug
publicasyncTask<HealthCheckResult>CheckHealthAsync(HealthCheckContextcontext,CancellationTokencancellationToken){varstopwatch=newStopwatch();try{stopwatch.Start();varclient=await_rcmClientConnectionProvider.OpenClient();// Error gets thrown here.varnamespaceInfo=awaitclient.WorkflowService.DescribeNamespaceAsync(newTemporalio.Api.WorkflowService.V1.DescribeNamespaceRequest{Namespace="default"},newRpcOptions{CancellationToken=cancellationToken});stopwatch.Stop();if(namespaceInfo==null){returnHealthCheckResult.Unhealthy($"Temporal namespace is unreachable: elapsed: {stopwatch.Elapsed}");}returnHealthCheckResult.Healthy();}catch(Exceptionex){stopwatch.Stop();returnHealthCheckResult.Unhealthy($"Temporal client is unreachable: elapsed: {stopwatch.Elapsed}",ex);}}
The _rcmClientConnectionProvider variable is a singleton service that maintains a single ITemporalClient (through OpenClient), used throughout the application (creating workflows and subscribing to task queues). It's code is like this:
publicasyncTask<ITemporalClient>OpenClient(){if(_client!=null){return_client;}await_semaphoreSlim.WaitAsync();try{if(_client==null){varoptions=newTemporalClientConnectOptions{TargetHost=$"{_options.HostName}:{_options.Port}",Namespace=_options.Namespace};if(serviceProvider.GetService(typeof(ILoggerFactory))isILoggerFactoryloggerFactory){options.LoggerFactory=loggerFactory;}try{_client=awaitTemporalClient.ConnectAsync(options);}catch(InvalidOperationExceptione){if(e.Message.StartsWith("Connection failed: Server connection error")){varmessage=$"Failed to connect to Temporal server at {_options.HostName}:{_options.Port}";if(_options.HostName=="localhost"){message+="\nA local instance of temporal can be ran by running 'temporal server start-dev'";}thrownewInvalidOperationException(message,e);}throw;}}return_client;}finally{_semaphoreSlim.Release();}}
Minimal Reproduction
It only happens in one environment, so I fear minimal repo may be hard to do.
One this worth mentioning is that I don't think this is actually a timeout issue, because the exception is thrown immediately-ish: Temporal client is unreachable: elapsed: 00:00:00.0022905.
The text was updated successfully, but these errors were encountered:
It only happens in one environment, so I fear minimal repo may be hard to do.
Is this only an issue on Azure or can anyone replicate it with the dev server? I fear if only one environment has the issue it may be specific to the environment. Ideally we can have a replication we can run in CI to know it has been fixed and continues to remain fixed.
Considering this timeout exception is being thrown immediately, should I not be sharing my TemporalClient across threads?
This particular method is a "health check" that's done periodically.
It doesn't look like TemporalClient implements IDisposable. Is it safe to create them and let the GC handle them? Will connection resources become starved?
What are you really trying to do?
Get info about a namespace, using 1.4.0 of the .NET SDK.
Describe the bug
The
_rcmClientConnectionProvider
variable is a singleton service that maintains a singleITemporalClient
(throughOpenClient
), used throughout the application (creating workflows and subscribing to task queues). It's code is like this:Minimal Reproduction
It only happens in one environment, so I fear minimal repo may be hard to do.
Environment/Versions
Temporal helm chart v0.54.0.
Temporal .NET SDK 1.4.0 (nuget)
Azure App Service (for Linux)
Additional context
This is the complete error, being reported by App Insights.
One this worth mentioning is that I don't think this is actually a timeout issue, because the exception is thrown immediately-ish:
Temporal client is unreachable: elapsed: 00:00:00.0022905
.The text was updated successfully, but these errors were encountered: