Skip to content

Starvation thread pool when working with the rabbitmq #22

@oleg-peresada

Description

@oleg-peresada

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(Func<IModel, T> channelAction) => this.InvokeAsync(channelAction).GetAwaiter().GetResult();

All this leads to the following result and suspending working the app:

image

image

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions