From 2c0b7eeb5b71013ec91b0dd7fb1a4dc7c246fa6e Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Thu, 13 Feb 2025 12:34:57 -0800 Subject: [PATCH] Fix rare deadlock, second try Fixes #1751 See if not awaiting `_reader.Completion` fixes the issue. --- .../ConsumerDispatcherChannelBase.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/RabbitMQ.Client/ConsumerDispatching/ConsumerDispatcherChannelBase.cs b/projects/RabbitMQ.Client/ConsumerDispatching/ConsumerDispatcherChannelBase.cs index 46623f6cf..0100fb3f3 100644 --- a/projects/RabbitMQ.Client/ConsumerDispatching/ConsumerDispatcherChannelBase.cs +++ b/projects/RabbitMQ.Client/ConsumerDispatching/ConsumerDispatcherChannelBase.cs @@ -161,8 +161,14 @@ public async Task WaitForShutdownAsync() { try { - await _reader.Completion - .ConfigureAwait(false); + /* + * rabbitmq/rabbitmq-dotnet-client#1751 + * Awaiting the work channel reader could deadlock - no idea why. + * Since we await the consumer dispatcher _worker task, + * that should suffice. + * + * await _reader.Completion.ConfigureAwait(false); + */ await _worker .ConfigureAwait(false); }