Persistent Channel error (potential timeout issue) while performing a "PublishAsync" or "RespondAsync" but not limited to these
See original GitHub issueSo i have created a simple worker service (.Net 7), which has the following code snippet.
rabbitMqBus = RabbitHutch.CreateBus("host=localhost");
await rabbitMqBus.Rpc.RespondAsync<ConnectToServerRequest, ConnectToServerResponse>(async request => { return new ConnectToServerResponse() { IsSeverConnected = true }; });
This code works absolutely fine on my laptop (dev machine), however, whenever i run it as a service or using a cmd on a deployment machine, i get the following error. Im not sure if im supposed to configure something before installing as a service (both RabbitMQ and the service is on the same machine, RabbitMQ Service is running. Also “RabbitMQ Webinterface “localhost:15672” does work properly on the deployment machine”)
I get the same error when i manually stop the RabbitMQ Service on my dev machine. (while trying to reproduce)
Following in the error, there is no cancellation token passed, i think it is a TimeOut error.
2023-05-22 17:23:49.750 +02:00 [ERR] BackgroundService failed System.Threading.Tasks.TaskCanceledException: A task was canceled. at EasyNetQ.Persistent.PersistentChannel.InvokeChannelActionAsync[TResult,TChannelAction](TChannelAction channelAction, CancellationToken cancellationToken) at EasyNetQ.RabbitAdvancedBus.ExchangeDeclareAsync(String name, Action1 configure, CancellationToken cancellationToken) at EasyNetQ.DefaultRpc.RespondAsyncInternal[TRequest,TResponse](Func3 responder, Action1 configure, CancellationToken cancellationToken) at Worker.ExecuteAsync(CancellationToken cancellationToken) in C:\Users\Server\Worker.cs:line 50 at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService) 2023-05-22 17:23:49.770 +02:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted. System.Threading.Tasks.TaskCanceledException: A task was canceled. at EasyNetQ.Persistent.PersistentChannel.InvokeChannelActionAsync[TResult,TChannelAction](TChannelAction channelAction, CancellationToken cancellationToken) at EasyNetQ.RabbitAdvancedBus.ExchangeDeclareAsync(String name, Action1 configure, CancellationToken cancellationToken) at EasyNetQ.DefaultRpc.RespondAsyncInternal[TRequest,TResponse](Func3 responder, Action1 configure, CancellationToken cancellationToken) at Worker.ExecuteAsync(CancellationToken cancellationToken) in C:\Users\Server\Worker.cs:line 50 at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
Please complete the following information):
- EasyNetQ version: 7.5.2
- RabbitMQ version 3.11.16
Issue Analytics
- State:
- Created 4 months ago
- Comments:5 (3 by maintainers)
@OmkarDaundVario @richard-green
Sorry, I forgot to reply yesterday. Current approach (with throwing OCE in the case unavailability to execute a command in a configured timeout) causes a lot of complaints and lack of visibility of errors under the hood.
I am trying to rework it in v7, hopefully will be able to do it. Otherwise, a fix will be available only for v8.
@Pliner i appreciate the additional info.