jhilden
jhilden

Reputation: 12429

RabbitMQ - tons of open channels

We have an issue with RabbitMQ on both the producer and the consumer side where over time tons of channels are created and never closed.

We have our IConnection Ninjected with InSingletonScope and we have a single producer that disposes the model immediately.

Any insight into why this may be happening?

enter image description here

Connection Code:

    Bind<IConnection>()
        .ToMethod(ctx =>
                  {
                      var factory = new ConnectionFactory
                                    {
                                        Uri = ConnectionString,
                                        RequestedHeartbeat = 15,
                                        //every N seconds the server will send a heartbeat.  If the connection does not receive a heartbeat within
                                        //N*2 then the connection is considered dead.
                                        //suggested from http://public.hudl.com/bits/archives/2013/11/11/c-rabbitmq-happy-servers/
                                        AutomaticRecoveryEnabled = true
                                    };

                      return factory.CreateConnection();
                  })
        .InSingletonScope();

Publisher code:

 public void Publish(string exchangeName, string routingKey, IBasicProperties basicProperties, byte[] messageBytes)
    {
        using (var model = _rabbitConnection.CreateModel())
        {
            model.BasicPublish(exchangeName, routingKey, basicProperties, messageBytes);
        }            
    }

Rabbit Version: 3.5.1

C# RabbitMQ.Client: 3.5.2

Upvotes: 1

Views: 83

Answers (1)

jhilden
jhilden

Reputation: 12429

This appears to be fixed on C# RabbitMQ.Client 3.5.4

https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/109

Upvotes: 2

Related Questions