ViennaNET
ViennaNET copied to clipboard
Starvation thread pool when working with the rabbitmq
When called IMessagingComponentFactory with SendMessageAsync A call was made inside the library ViennaNET
public async Task
SendAsync( BaseMessage message, IReadOnlyDictionary<string, object> additionalProperties = null, CancellationToken cancellationToken = default (CancellationToken)) => await Task.Factory.StartNew ((Func ) (() => this.SendMessage(message, additionalProperties)), cancellationToken);
which calls the method in the inside EeasyMQ
public void Publish( IExchange exchange, string routingKey, bool mandatory, MessageProperties messageProperties, byte[] body)
which makes this call
public T Invoke<T>(Func<IModel, T> channelAction) => this.InvokeAsync<T>(channelAction).GetAwaiter().GetResult();
All this leads to the following result and suspending working the app:
Currently there is no way to call pure async method (PublishAsync) from the ViennaNET, what leads to starvation thread pool. (https://docs.microsoft.com/en-us/archive/blogs/vancem/diagnosing-net-core-threadpool-starvation-with-perfview-why-my-service-is-not-saturating-all-cores-or-seems-to-stall)
Quote from the documentation: With publisher confirms on the synchronous publish method will slow down significantly. If performance is a concern, you should consider using the PublishAsync method.