pardahlman / RawRabbit

A modern .NET framework for communication over RabbitMq
MIT License
747 stars 144 forks source link

Get Operation causing "ChannelAllocationException: The connection cannot support any more channels. Consider creating a new connection" #325

Closed Ankurkh1 closed 6 years ago

Ankurkh1 commented 6 years ago

Hi,

I am trying to make use of Get operation. My requirement is that queue will keep accumulating messages and periodically I will run basic get operation to get messages up to a certain limit. While using get I am seeing that system is creating channels on existing connection and but not releasing them. After a few hours I get a "ChannelAllocationException: The connection cannot support any more channels. Consider creating a new connection"

In RabbitMQ management UI, I can see channel count increasing on the same connection for every get. I even tried using new IBusClient for every run by registering IBusclient as transient. Still see the same error.

Is there a reason GetOFTOperation not making use of PooledChannelMiddleware?

Am I doing anything wrong? Any help will be greatly appreciated.

pardahlman commented 6 years ago

Hi @Ankurkh1 - thanks for reaching out! Your use case is a valid one for the Get operation. Unfortunately this operation has not gotten a lot of attention lately. The bug here is the fact that Get uses ChannelCreationMiddleware which creates a new channel without ever disposing it 🤦‍♂️. There is no reason why the channel pool isn't used, in fact I really think that it should be.

It seems like you have the basic idea of what to do, I'd be happy to accept a PR for this that:

vivekvenugopal commented 2 years ago

Hi We are having this issue from our production rabbitmq. Was this issue fixed???