[rabbitmq-discuss] pika 0.9.5 - trouble closing a connection?

Gavin M. Roy gmr at myyearbook.com
Fri Jun 29 20:07:38 BST 2012


IIRC channels in _channels are not removed until Channel.CloseOk is received from Rabbit, even if you asked for a Channel.Close. 

On Friday, June 29, 2012 at 3:01 PM, Ask Solem wrote:

> 
> On 18 Jun 2012, at 11:49, Darren wrote:
> 
> > 
> > Not sure if this is user error or not, but I am opening a blocking connection:
> > 
> > self.credentials = pika.PlainCredentials(settings.BROKER_USERNAME, settings.BROKER_PASSWORD)
> > self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=settings.BROKER_HOSTNAME, port=settings.BROKER_PORT, credentials=self.credentials))
> > self.channel = self.connection.channel()
> > self.callback_queue = self.channel.queue_declare().method.queue
> > 
> > and I try to close it like this:
> > self.channel.queue_delete(queue=self.callback_queue)
> > self.connection.close()
> > 
> > However, as seen from Rabbit MQ management console, the connection.close() method deletes the channels, but NOT the connection?
> > Now, the close method calls: BaseConnection.close(self, code, text)
> > which calls:
> > for channel_number in self._channels.keys():
> > self._channels[channel_number].close(code, text) # this closes the channel
> > 
> > # If we already dont have any channels, close out
> > if not self._channels:
> > self._on_close_ready() # never gets here?
> > 
> > If instead, I have:
> > self.connection.close()
> > self.connection._on_close_ready()
> > 
> > then everything shuts down ok?
> 
> If there are still channels in _channels after that closing loop
> ends then I'm inclined to think this is a bug in pika.
> Maybe you should open up an issue here:
> https://github.com/pika/pika/issues
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com (mailto:rabbitmq-discuss at lists.rabbitmq.com)
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> 
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120629/faccb1de/attachment.htm>


More information about the rabbitmq-discuss mailing list