 <p>You have some bugs in your getMessages function in the while loop:<br/> 1. use <code>count += len(rs)</code><br/> 2. The major bug: you don't need the </p> <pre><code>or len(rs) &lt; 10 </code></pre> <p>condition because SQS can get up to 10 messages and if your queue is full and each time you get 10 messages you'll have an infinite loop.</p> <p>Also I think you should consider using <code>yield</code> statement to return the messages, process them and after they are processed, only then , remove them from Queue.</p> <p>One more thing, the pythonic way to check <code>if len(rs) &lt; 1:</code> is <code>if not rs:</code></p>