Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

RabbitMQ channel.CallbackException causes blocks and causes deadlock when disposing channel #1052

Closed
david-ernstsson-stratsys opened this issue May 28, 2019 · 4 comments

Comments

@david-ernstsson-stratsys

Hi, after changing to using AsyncEventingBasicConsumer in #987 deadlock occurs when unhandled exception

If an unhandled exception occurs in EventBusRabbitMQ.Consumer_Received and channel.CallbackException is invoked then with current implementation _consumerChannel.Dispose(); blocks and causes deadlock

Thoughts on this? I've failed to find a fix for this and instead choosing to not do anything when _consumerChannel.IsOpen

Links with same problem:
https://groups.google.com/forum/#!topic/rabbitmq-users/N76hwS7BEpg
rabbitmq/rabbitmq-dotnet-client#341

@mvelosop
Copy link
Collaborator

Hi @david-ernstsson-stratsys, thanks for the heads up!

What caused the exception?, I'd like to reproduce it to take a closer look.

Thanks.

@david-ernstsson-stratsys
Copy link
Author

@mvelosop
Manually throwing a new exception instead of say acking the message should do it. There being an exceptioncallback with logic to restore the channel one could presume that would be alright? Behavior then seems to be either a block/deadlock on dispose or it takes some seconds there and instead a block/deadlock on _connection.CreateModel() in DefaultRabbitMQPersistentConnection

This problem only occurs when using async consumer

@mvelosop
Copy link
Collaborator

Hi @david-ernstsson-stratsys,

I've been investigating about this "interesting" issue, and even though I couldn't reproduce it, I had found a similar deadlock issue that stopped orders from getting to the final Paid status.

Beginning with one of your suggested links and reading a "bit" I got to a change that seems to have solved my deadlock issue.

Could you try branch fix/1052-rabbitmq-deadlock or at least apply the canges of commit 2621c36 to your repo, to check if this works for you too?

Hope this helps.

@mvelosop
Copy link
Collaborator

Although I couldn't reproduce this specific problem, a similar deadlock issue that occurred always during regular processing on the last order status, was solved with PR #1079.

So I'm closing this issue now, but feel free to comment. Will reopen if needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants