-
Notifications
You must be signed in to change notification settings - Fork 615
Closed
Labels
Description
RabbitMq.Client: 6.1.0 + net.core 3.1
We have a sample that was expected to measure consumer throughput but instead it hangs on consumer connection dispose.
Full code: RabbitMqHangsOnDispose.zip
Problem part:
private static async Task<string[]> ReceiveAsync(
IConnectionFactory connectionFactory,
int parallelCount,
int expectedCount)
{
string[] result;
using (var connection = connectionFactory.CreateConnection())
{
using (var channel = connection.CreateModel())
{
channel.BasicQos(0, (ushort) parallelCount, false);
var completed = new TaskCompletionSource<string[]>();
var consumer = new EventingBasicConsumer(channel);
consumer.Received += (s, e) => ...
var tag = channel.BasicConsume(...);
result = await completed.Task;
channel.BasicCancel(tag);
Console.WriteLine("Before close channel");
}
Console.WriteLine("Before close connection");
} // < hangs on Dispose() call
Console.WriteLine("All closed - never called!");
return result;
}Expected behavior: connection disposal should complete successfully.