<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; "><div>I'm experiencing a KeyError exception, where the key is "Tx.SelectOk" when using Pika 0.9.5.</div><div><br></div><div>The scenario: A simple program that simply writes two messages a second to a queue. While this test is running, I stop the broker, then restart it a few seconds later. I explicitly check for AMQPConnectionError exceptions, and if seen reconnect to the broker. About half the time, the test works as intended. However, other times I see the KeyError exception, which my guess is not what's intended.</div><div><br></div><div>My writing code looks like this:</div><div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel = self._channel</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel.tx_select()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel.basic_publish(exchange='',</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; routing_key=queue_name,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body=json_string,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties=pika.BasicProperties(delivery_mode=2))</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel.tx_commit()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except AMQPConnectionError as e:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self._reconnect()</div></div></div><div><br></div><div>Digging into the traceback data, the faulting line is in Pika's&nbsp;blocking_connection.py:rpc()</div><div><br></div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; # Find our reply in our list of replies</div><div>&nbsp; &nbsp; &nbsp; &nbsp; for reply in self._replies:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if reply in replies:</div><div><b><u>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame = self._frames[reply] # THIS HERE IS THE LINE</u></b></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self._received_response = True</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if callback:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callback(frame)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del(self._frames[reply])</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return frame</div></div><div><br></div><div>Known issue? Expected and acceptable? Thoughts?</div><div><br></div><div>Thanks,</div><div><br></div><div>Matt</div></body></html>