Channels are not deleted when a queue is deleted #85

Open
michaelplaing opened this Issue Mar 27, 2012 · 4 comments

Projects

None yet

4 participants

@michaelplaing

One of my apps handles thousands of clients, creating and deleting queues for them. It maintains a single connection with rabbitmq for this purpose. When a queue is deleted its channels remain, causing channels to accumulate. The connection is always busy and cannot be recycled. A connection per client would overcome other resources, I believe.

@skrat
skrat commented May 1, 2012

I might be facing the same issue. I noticed that RabbitMQ memory usage is steadily increasing without any change to load (no we didn't get 300% more popular and more users :( . Same number of queues and messages, so I checked number of channels and I've tens of thousands of channels. After restarting my node app, they disappeared and mem. usage dropped from 700M to 200M. Using this code: https://github.com/skrat/celery.js/blob/master/celery.js

@skrat
skrat commented May 21, 2012

Nice to have you back :) I've bee looking into this myself, but without much success so far.

@jameskeane

I believe you are running into the same problem as I was, the problem is to do with node-amqp not properly closing channels on error as in #136.

I have a work flow that was very 404 heavy, and would accumulate tens of thousands of channels every few hours, eating memory and destroying our servers. After implementing the fix in #137, we have seen no issues.

Good luck :)

@axelson
axelson commented Aug 18, 2014

I know this is an old issue but it's still open so I'm going to reply.

I just dealt with this in my code. There are a couple options. If you're correctly unsubscribing from the queue you can set closeChannelOnUnsubscribe to true (defaults to false).

closeChannelOnUnsubscribe : a boolean when true the channel will close on unsubscribe, default false.

Or you can call close on the channel instead of unsubscribe (but beware if you have multiple consumers for the queue). There's probably a way to close a channel that you unsubscribed to but I haven't spent the time to figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment