Error in multithreaded environment

52 views
Skip to first unread message

ceelian

unread,
Aug 15, 2009, 11:09:25 AM8/15/09
to carrot-users
Hi,

I got this strange error in a simple multithreaded environment. Is
there something to pay attention? eg. AMQPConnection, Publisher,
Consumer -> threadsafe?

cheers,
Christian

This is the error I got:

Exception in thread Thread-23:
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 525, in
__bootstrap_inner
self.run()
File "/home/christian/devel/CarrotNG/Main/rainbow-qam/QAM/QAMlib/src/
qamproxy.py", line 167, in run
self.consumer.wait()
File "/usr/local/lib/python2.6/dist-packages/carrot-0.5.1-py2.6.egg/
carrot/messaging.py", line 423, in wait
it.next()
File "/usr/local/lib/python2.6/dist-packages/carrot-0.5.1-py2.6.egg/
carrot/backends/pyamqplib.py", line 165, in consume
self.channel.wait()
File "build/bdist.linux-i686/egg/amqplib/client_0_8/
abstract_channel.py", line 64, in wait
self.channel_id, allowed_methods)
File "build/bdist.linux-i686/egg/amqplib/client_0_8/connection.py",
line 221, in _wait_method
self.wait()
File "build/bdist.linux-i686/egg/amqplib/client_0_8/
abstract_channel.py", line 80, in wait
return amqp_method(self, args)
File "build/bdist.linux-i686/egg/amqplib/client_0_8/connection.py",
line 366, in _close
raise AMQPConnectionException(reply_code, reply_text, (class_id,
method_id))
AMQPConnectionException: (503, u'COMMAND_INVALID - expected content
header for class 60, got non content header frame instead', (0, 0),
'')

Christian Haintz

unread,
Aug 15, 2009, 1:49:59 PM8/15/09
to carrot...@googlegroups.com
Well, I solved it. Problem was regarding multithreading in general
with AMQP. I found the solution in this article
http://hopper.squarespace.com/blog/2008/10/6/multithreading-amqp-clients.html

Thx anyway.

cheers,
christian

Ask Solem

unread,
Aug 15, 2009, 5:21:51 PM8/15/09
to carrot...@googlegroups.com

On Aug 15, 2009, at 7:49 PM, Christian Haintz wrote:

> Well, I solved it. Problem was regarding multithreading in general
> with AMQP. I found the solution in this article
> http://hopper.squarespace.com/blog/2008/10/6/multithreading-amqp-clients.html
>
> Thx anyway.
>
> cheers,
> christian

Yeah, it's not that weird if you think about it.

A new instance of the consumer class should be enough to create a new
channel (at least using the latest master branch at github). So
sharing connections should be fine but not consumers/publishers.

>>> conn = AMQPConnection(...)

# Thread1
>>> consumer1 = Consumer(conn=conn, ...)

# Thread2
>>> consumer2 = Consumer(conn=conn, ...)

If this is not the case, please file a bug.

Reply all
Reply to author
Forward
0 new messages