<html><head><base href="x-msg://1069/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Hi David,</div><div><br></div><div>What *kind* of adapter is this connection please? I know very little about Pika, but I can attempt to figure out what you *should* be doing to get the behaviour you want. But there's a big difference between the behaviours of say, the blocking versus the polling/select based adapters.</div><div><br></div><div>Cheers,</div><div>Tim </div><div><br></div><div><br></div><div>On 29 Aug 2012, at 10:42, David Myllykangas wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><font face="Arial, sans-serif" size="3"><div> </div><div><font size="2">Hi</font></div><div><font size="2"> </font></div><div><font size="2">We are using Rabbit 2.8.5 and Pika 0.9.5 to process rabbit-queue from python.</font></div><div><font size="2"> </font></div><div><font size="2">If I am doing a 'rabbitctrl stop' to stop Rabbit Server, my python script hangs, and get uninteruptable.</font></div><div><font size="2"> </font></div><div><font size="2">This is the console output I get when I stop the Rabbit Server</font></div><div><font size="2"> </font></div><div><font face="Courier New, monospace" size="2">Traceback (most recent call last):</font></div><div><font face="Courier New, monospace" size="2"> File ".../pycims/queue.py", line 87, in start_consuming</font></div><div><font face="Courier New, monospace" size="2"> connection.ioloop.start()</font></div><div><font face="Courier New, monospace" size="2"> File ".../pika/adapters/select_connection.py", line 124, in start</font></div><div><font face="Courier New, monospace" size="2"> self.poller.start()</font></div><div><font face="Courier New, monospace" size="2"> File ".../pika/adapters/select_connection.py", line 374, in start</font></div><div><font face="Courier New, monospace" size="2"> self.poll()</font></div><div><font face="Courier New, monospace" size="2"> File ".../pika/adapters/select_connection.py", line 388, in poll</font></div><div><font face="Courier New, monospace" size="2"> self._handler(events[0][0], events[0][1])</font></div><div><font face="Courier New, monospace" size="2"> File ".../pika/adapters/base_connection.py", line 137, in _handle_events</font></div><div><font face="Courier New, monospace" size="2"> self._handle_error(error)</font></div><div><font face="Courier New, monospace" size="2"> File ".../pika/adapters/base_connection.py", line 106, in _handle_error</font></div><div><font face="Courier New, monospace" size="2"> error_code = error[0] # Python <= 2.5</font></div><div><font face="Courier New, monospace" size="2">TypeError: 'NoneType' object is not subscriptable</font></div><div><font face="Courier New, monospace" size="2"> </font></div><div><font size="2">This is the code; (I am expecting an Exception to be thrown on line 93, so I can handle the situation.) What am I doing wrong?</font></div><div><font size="2"> </font></div><div><font face="Consolas" size="2">86<font face="Consolas"> <span class="Apple-converted-space"> </span></font><font face="Consolas" color="#0000FF">try</font><font face="Consolas">:</font></font></div><div><font face="Consolas" size="2">87<font face="Consolas"> connection.ioloop.start()</font></font></div><div><font face="Consolas" size="2">88<font face="Consolas"> <span class="Apple-converted-space"> </span></font><font face="Consolas" color="#0000FF">except</font><font face="Consolas"><span class="Apple-converted-space"> </span>KeyboardInterrupt:</font></font></div><div><font face="Consolas" size="2">89<font face="Consolas"> <span class="Apple-converted-space"> </span></font><font face="Consolas"><i>self</i></font><font face="Consolas">.stop_consuming()</font></font></div><div><font face="Consolas" size="2">90<font face="Consolas"> connection.ioloop.stop()</font></font></div><div><font face="Consolas" size="2">91<font face="Consolas"> connection.close()</font></font></div><div><font face="Consolas" size="2">92<font face="Consolas"> <span class="Apple-converted-space"> </span></font><font face="Consolas" color="#0000FF">raise</font></font></div><div><font face="Consolas" size="2">93<font face="Consolas"> <span class="Apple-converted-space"> </span></font><font face="Consolas" color="#0000FF">except</font><font face="Consolas"><span class="Apple-converted-space"> </span>Exception, e:</font></font></div><div><font face="Consolas" size="2">94<font face="Consolas"> <span class="Apple-converted-space"> </span></font>print<span class="Apple-converted-space"> </span><font face="Consolas" color="#00AA00"><i>'Exception %s'</i></font><font face="Consolas"><span class="Apple-converted-space"> </span>% str(e)</font></font></div><div><font face="Consolas" size="2">95<font face="Consolas"> <span class="Apple-converted-space"> </span></font><font face="Consolas" color="#0000FF">raise</font></font></div><div><font face="Consolas" size="2"> </font></div><div><font face="Consolas" size="2">Thanks,</font></div><div><font face="Consolas" size="2">David</font></div><div><font size="2"> </font></div></font>_______________________________________________<br>rabbitmq-discuss mailing list<br><a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br></div></span></blockquote></div><br></body></html>