[rabbitmq-discuss] Help with "AttributeError: 'BlockingConnection' object has no attribute 'disconnect'"

Badjatya, Nikunj Nikunj.Badjatya at emc.com
Tue Jan 21 19:31:56 GMT 2014


Thank you for the quick response. It is 0.9.13.

>>> pika.__version__
'0.9.13'
>>>


From: Gavin M. Roy [mailto:gavinmroy at gmail.com]
Sent: Wednesday, January 22, 2014 12:59 AM
To: Badjatya, Nikunj; Discussions about RabbitMQ
Subject: Re: [rabbitmq-discuss] Help with "AttributeError: 'BlockingConnection' object has no attribute 'disconnect'"

Looks like a bug. I’ve opened a ticket @ https://github.com/pika/pika/issues/435

Ultimately, you’re being disconnected from RabbitMQ which is causing pika to want to handle the disconnection cleanly, but somehow it’s missing in your version of pika.

Can you please provide the version of pika installed on the ticket?

import pika
pika.__version__

Regards,

Gavin

________________________________
From: Badjatya, Nikunj Badjatya, Nikunj<mailto:nikunj.badjatya at emc.com>
Reply: Discussions about RabbitMQ rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
Date: January 21, 2014 at 2:26:11 PM
To: rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com> rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
Subject:  [rabbitmq-discuss] Help with "AttributeError: 'BlockingConnection' object has no attribute 'disconnect'"
Hello All,

Need your help with the error I have been facing.
The channel creation (or the basic_publish operation) throws error as “AttributeError: 'BlockingConnection' object has no attribute 'disconnect'”, when there is a time gap between connection establishment and channel creation (or basic_publish operation).

I am using Pika python amqp client and running rabbitmq-server ver 3.1.3-1 on SLES-11sp3.

Python 2.6.8 (unknown, May 29 2012, 22:30:44)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import pika
>>> VEXCHANGE = 'exchange.external'
>>> connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',connection_attempts=3,retry_delay=5))
>>> vchannel = connection.channel();
>>> BODY = "blahblah"
>>> vchannel.basic_publish(exchange=VEXCHANGE,routing_key='#',body=str(BODY),properties=pika.BasicProperties(delivery_mode = 2,))

This message is getting published without any issues. However, if after sometime (say 5 minutes) I do basic_publish again, I get below error.

>>> vchannel.basic_publish(exchange=VEXCHANGE,routing_key='#',body=str(BODY),properties=pika.BasicProperties(delivery_mode = 2,))
No handlers could be found for logger "pika.adapters.base_connection"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 540, in basic_publish
    (properties, body), False)
  File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 1121, in _send_method
    self.connection.send_method(self.channel_number, method_frame, content)
  File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 249, in send_method
    self._send_method(channel_number, method_frame, content)
  File "/usr/lib64/python2.6/site-packages/pika/connection.py", line 1489, in _send_method
    self._send_frame(frame.Method(channel_number, method_frame))
  File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 388, in _send_frame
    super(BlockingConnection, self)._send_frame(frame_value)
  File "/usr/lib64/python2.6/site-packages/pika/connection.py", line 1476, in _send_frame
    self._flush_outbound()
  File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 348, in _flush_outbound
    if self._handle_write():
  File "/usr/lib64/python2.6/site-packages/pika/adapters/base_connection.py", line 338, in _handle_write
    return self._handle_error(error)
  File "/usr/lib64/python2.6/site-packages/pika/adapters/base_connection.py", line 282, in _handle_error
    self._handle_disconnect()
  File "/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py", line 318, in _handle_disconnect
    self.disconnect()
AttributeError: 'BlockingConnection' object has no attribute 'disconnect'

>>>

At this time, I get the same error when I run
>>>vchannel = connection.channel()


The config file has the default heartbeat set to 30 seconds.

Any idea on what causing this error to come?

Thanks,
Nikunj

_______________________________________________
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/20140121/4b2a54d3/attachment.html>


More information about the rabbitmq-discuss mailing list