barryp / py-amqplib

Python client for the Advanced Message Queuing Procotol (AMQP)
GNU Lesser General Public License v2.1
24 stars 10 forks source link

queue defined outside thread becomes unuseable when thread is killed #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which version of amqplib are you using?
0.6.1

Have you checked to see if there is a newer version in the "Featured
Downloads" section of the front page of this project?

Which broker are you using (RabbitMQ?) which version?
+---+   +---+
|   |   |   |
|   |   |   |
|   |   |   |
|   +---+   +-------+
|                   |
| RabbitMQ  +---+   |
|           |   |   |
|   v2.2.0  +---+   |
|                   |
+-------------------+

Which version of Python?
2.6.2

What steps will reproduce the problem?
two processes in two windows, one produces, the other consumes 
and may be varied as to how it consumes - whether a basic_get
or a basic_consume inside a thread

1. channel.basic_get() tests ok in the consumer
2. then commanded to threaded subscribe - basic_consume() followed by 
channel.wait()
3. then commanded to Unsubscribe via a thread.kill()
4. then commanded again to channel.basic_get() which now fails, the 
exception is that the queue is no longer recognized. 
5. However, if re-subscribed, the consumer can again consume

What is the expected output? What do you see instead?

The thread kill() on basic_consume() should not prevent basic_get() from 
working.

Please provide any additional information below.

Original issue reported on code.google.com by r...@haystack.mit.edu on 30 Nov 2010 at 7:46

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, amqplib is not totally threadsafe.  That's a big omission from the docs, 
fixed in Rev 2c694206543d   

You can however use it in a threaded program as long separate threads keep 
separate Connection objects (and related Channel objects).  

Original comment by barry.pe...@gmail.com on 28 Mar 2011 at 7:06