<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Looks like a bug. I’ve opened a ticket @ <a href="https://github.com/pika/pika/issues/435">https://github.com/pika/pika/issues/435</a></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">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.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Can you please provide the version of pika installed on the ticket?</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">import pika</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">pika.__version__</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Regards,</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Gavin</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <div id="bloop_sign_1390332409605794048" class="bloop_sign"></div> <div style="color:gray"><hr style="style:linear">From: <span style="color:black">Badjatya, Nikunj</span> <a href="mailto:nikunj.badjatya@emc.com">Badjatya, Nikunj</a><br>Reply: <span style="color:black">Discussions about RabbitMQ</span> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>Date: <span style="color:black">January 21, 2014 at 2:26:11 PM</span><br>To: <span style="color:black">rabbitmq-discuss@lists.rabbitmq.com</span> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>Subject: <span style="color:black"> [rabbitmq-discuss] Help with "AttributeError: 'BlockingConnection' object has no attribute 'disconnect'" <br></span></div> <blockquote type="cite" class="clean_bq"><span><div lang="EN-US" link="blue" vlink="purple" xml:lang="EN-US"><div>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<title></title>
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hello
All,</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">Need your help
with the error I have been facing.</span></p>
<p class="MsoNormal"><span style="color:#1F497D">The channel
creation (or the basic_publish operation) throws error as
<b>“AttributeError: 'BlockingConnection' object has no attribute
'disconnect'”, when</b> there is a time gap between connection
establishment and channel creation (or basic_publish
operation).</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">I am using Pika
python amqp client and running rabbitmq-server ver 3.1.3-1 on
SLES-11sp3.</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">Python 2.6.8
(unknown, May 29 2012, 22:30:44)</span></p>
<p class="MsoNormal"><span style="color:#1F497D">[GCC 4.3.4
[gcc-4_3-branch revision 152973]] on linux2</span></p>
<p class="MsoNormal"><span style="color:#1F497D">Type "help",
"copyright", "credits" or "license" for more
information.</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>>
import pika</span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>>
VEXCHANGE = 'exchange.external'</span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>>
connection =
pika.BlockingConnection(pika.ConnectionParameters(host='localhost',connection_attempts=3,retry_delay=5))</span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>>
vchannel = connection.channel();</span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>> BODY
= "blahblah"</span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>>
vchannel.basic_publish(exchange=VEXCHANGE,routing_key='#',body=str(BODY),properties=pika.BasicProperties(delivery_mode
= 2,))</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><b><span style="color:#1F497D">This message is
getting published without any issues. However, if after sometime
(say 5 minutes) I do basic_publish again, I get below
error.</span></b></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>>
vchannel.basic_publish(exchange=VEXCHANGE,routing_key='#',body=str(BODY),properties=pika.BasicProperties(delivery_mode
= 2,))</span></p>
<p class="MsoNormal"><span style="color:#1F497D">No handlers could
be found for logger "pika.adapters.base_connection"</span></p>
<p class="MsoNormal"><span style="color:#1F497D">Traceback (most
recent call last):</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"<stdin>", line 1, in <module></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py",
line 540, in basic_publish</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
(properties, body), False)</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py",
line 1121, in _send_method</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
self.connection.send_method(self.channel_number, method_frame,
content)</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py",
line 249, in send_method</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
self._send_method(channel_number, method_frame, content)</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/connection.py", line 1489,
in _send_method</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
self._send_frame(frame.Method(channel_number,
method_frame))</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py",
line 388, in _send_frame</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
super(BlockingConnection, self)._send_frame(frame_value)</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/connection.py", line 1476,
in _send_frame</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
self._flush_outbound()</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py",
line 348, in _flush_outbound</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
if self._handle_write():</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/base_connection.py",
line 338, in _handle_write</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
return self._handle_error(error)</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/base_connection.py",
line 282, in _handle_error</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
self._handle_disconnect()</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> File
"/usr/lib64/python2.6/site-packages/pika/adapters/blocking_connection.py",
line 318, in _handle_disconnect</span></p>
<p class="MsoNormal"><span style="color:#1F497D">
self.disconnect()</span></p>
<p class="MsoNormal"><b><span style="color:#1F497D">AttributeError:
'BlockingConnection' object has no attribute
'disconnect'</span></b></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">>>></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><b><span style="color:#1F497D">At this time, I
get the same error when I run</span></b></p>
<p class="MsoNormal"><b><span style="color:#1F497D">>>>vchannel =
connection.channel()</span></b></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">The config file
has the default heartbeat set to 30 seconds.</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">Any idea on what
causing this error to come?</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks,</span></p>
<p class="MsoNormal"><span style="color:#1F497D">Nikunj</span></p>
<p class="MsoNormal"> </p>
</div>
_______________________________________________
<br>rabbitmq-discuss mailing list
<br>rabbitmq-discuss@lists.rabbitmq.com
<br>https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
<br></div></div></span></blockquote></body></html>