[rabbitmq-discuss] pika 0.9.5 - trouble closing a connection?
Ask Solem
ask at rabbitmq.com
Fri Jun 29 20:01:53 BST 2012
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
More information about the rabbitmq-discuss
mailing list