From 77eb7f52bb0353c0fa3fa77490b764c6a7a862cc Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Mon, 16 Mar 2020 13:32:55 -0700 Subject: [PATCH] Yield to prevent deadlocks Based on this comment by @danielmarbach: > So the solution here is to do a Yield at the beginning of the event handler or for safety precaution reasons it would be possible to modify to Work class to do it uniformly --- projects/client/RabbitMQ.Client/src/client/impl/Work.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/client/RabbitMQ.Client/src/client/impl/Work.cs b/projects/client/RabbitMQ.Client/src/client/impl/Work.cs index ed84f97783..6670933d15 100644 --- a/projects/client/RabbitMQ.Client/src/client/impl/Work.cs +++ b/projects/client/RabbitMQ.Client/src/client/impl/Work.cs @@ -16,6 +16,7 @@ public async Task Execute(ModelBase model) { try { + await Task.Yield(); await Execute(model, _asyncConsumer).ConfigureAwait(false); } catch (Exception)