Hello,

I am working an a Python program that receives XML-RPC calls from Java
clients, and then create AMQP queues for each client.
To create channel, exchanges and queues, we use pika and SelectConnection.

So I first create and start a SelectConnection, then I create a channel. On
the reception of the on_open_callback of the channel, I try to declare a
queue.
The problem is that about 10% of time, a weird error occurs on the
declaration of the queue :

File "/usr/lib/python2.6/multiprocessing/process.py", line 232, in
_bootstrap
self.run()
File "/usr/lib/python2.6/multiprocessing/process.py", line 88, in run
self._target(*self._args, **self._kwargs)
File
"/home/adgeg/Sources/svn/TOTEM/Sandbox/TSP-MARGE-Communication/RabbitMQ/RabbitMQTOTEMLibrary/Python/net/totem/gamelogic/creategamelogicserver.py",
line 42, in createGameLogicServer
state.connection.ioloop.start()
File
"/home/adgeg/local/bin/pika-0.9.5/pika/adapters/select_connection.py", line
124, in start
self.poller.start()
File
"/home/adgeg/local/bin/pika-0.9.5/pika/adapters/select_connection.py", line
374, in start
self.poll()
File
"/home/adgeg/local/bin/pika-0.9.5/pika/adapters/select_connection.py", line
388, in poll
self._handler(events[0][0], events[0][1])
File "/home/adgeg/local/bin/pika-0.9.5/pika/adapters/base_connection.py",
line 134, in _handle_events
self._handle_read()
File "/home/adgeg/local/bin/pika-0.9.5/pika/adapters/base_connection.py",
line 162, in _handle_read
self._on_data_available(data)
File "/home/adgeg/local/bin/pika-0.9.5/pika/connection.py", line 599, in
_on_data_available
self._channels[frame.channel_number].transport.deliver(frame)
File "/home/adgeg/local/bin/pika-0.9.5/pika/channel.py", line 64, in
deliver
self.frame_dispatcher.process(frame)
File "/home/adgeg/local/bin/pika-0.9.5/pika/frame.py", line 202, in
process
self._handler(frame)
File "/home/adgeg/local/bin/pika-0.9.5/pika/frame.py", line 220, in
_handle_method_frame
raise NotImplementedError(frame.method.__class__)
NotImplementedError: <class 'pika.spec.DeclareOk'>

We have already sent you a mail 6 months ago, and someone tell us to change
the pika source code to have a better understanding of this error, and here
is the result :
File "/home/adgeg/local/bin/pika-0.9.5/pika/frame.py", line 220, in
_handle_method_frame
raise NotImplementedError(frame.method.__class__)
NotImplementedError: <Method(['frame_type=1', 'channel_number=1',
"method=<Queue.DeclareOk(['queue=michel', 'message_count=0',
'consumer_count=0'])>"])>

I have looked to our source code, and I found that we were using the same
channel in two different threads.
So I create a new channel (with its own SelectConnection) for the second
thread... but the error is still raised.
Curiously, I have found a way to highly reduce appearance frequency of the
error: I accidentally add a call to a system command on the Python source
code on the on_open_callback, just before declaring the queue (rabbitmqctl
list_user_permissions, to check that I have the required permissions to
declare a queue).

And now, it seems that we arrived to an appearance frequency of 3 times on
2000 tries.
So I suppose that without this additional little time period,
the on_open_callback is triggered, but the channel seems not able to
declare a queue.
Do you know some related issues of this kind on SelectConnections?

Thanks a lot,

Gabriel Adgeg

PS : I am using RabbitMQ 2.7.0, Erlang R13B03, Python 2.6.5, pika 0.9.5,
on Ubuntu 10.04.3 LTS. The error also occurs with Erlang R14B04, Python
2.7.2, on Windows XP and Windows 7. And it was already there when we were
using RabbitMQ 2.5.1.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111206/2099c7db/attachment.htm>

Search Discussions

  • Gavin M. Roy at Dec 6, 2011 at 3:02 pm

    On Tuesday, December 6, 2011 at 9:25 AM, gabriel adgeg wrote:
    I have looked to our source code, and I found that we were using the same channel in two different threads.
    So I create a new channel (with its own SelectConnection) for the second thread... but the error is still raised.
    You should keep the use of pika isolated per thread. IE don't reshare a connection or channel across threads.

    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111206/a7d36c62/attachment.htm>
  • Gabriel adgeg at Dec 6, 2011 at 4:32 pm
    I am sorry for the misunderstanding, but I think it is exactly what I have
    done.
    Now, I have 2 threads, and each thread uses its own connection and its own
    channel, without any share.
    Yet, the error is still raised.

    Thanks

    2011/12/6 Gavin M. Roy <gmr at myyearbook.com>
    On Tuesday, December 6, 2011 at 9:25 AM, gabriel adgeg wrote:


    I have looked to our source code, and I found that we were using the same
    channel in two different threads.
    So I create a new channel (with its own SelectConnection) for the second
    thread... but the error is still raised.

    You should keep the use of pika isolated per thread. IE don't reshare a
    connection or channel across threads.
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111206/1e23d80e/attachment.htm>
  • Gavin M. Roy at Dec 6, 2011 at 4:42 pm
    If you are able, please create a simple example that demonstrates the error and create an issue to track at:

    http://github.com/pika/pika

    I will be better able to help with the example.

    Thanks,

    Gavin

    On Tuesday, December 6, 2011 at 11:32 AM, gabriel adgeg wrote:

    I am sorry for the misunderstanding, but I think it is exactly what I have done.
    Now, I have 2 threads, and each thread uses its own connection and its own channel, without any share.
    Yet, the error is still raised.

    Thanks

    2011/12/6 Gavin M. Roy (mailto:gmr at myyearbook.com)>
    On Tuesday, December 6, 2011 at 9:25 AM, gabriel adgeg wrote:

    I have looked to our source code, and I found that we were using the same channel in two different threads.
    So I create a new channel (with its own SelectConnection) for the second thread... but the error is still raised.


    You should keep the use of pika isolated per thread. IE don't reshare a connection or channel across threads.
    _______________________________________________
    rabbitmq-discuss mailing list
    rabbitmq-discuss at lists.rabbitmq.com (mailto:rabbitmq-discuss at lists.rabbitmq.com)
    https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111206/0e1ca515/attachment.htm>
  • Gabriel adgeg at Dec 7, 2011 at 10:34 am
    Hello Gavin,

    I was wrong: contrary to what I thought I was doing, I was still using the
    same SelectConnection and the channel in two different threads...
    Finally, I have decided to replace the SelectConnection with a
    BlockingConnection, and to do all within a single thread.
    Now, the error isn't raised anymore.

    Thanks a lot,

    Gabriel
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111207/865c1513/attachment.htm>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedDec 6, '11 at 2:25p
activeDec 7, '11 at 10:34a
posts5
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Gabriel adgeg: 3 posts Gavin M. Roy: 2 posts

People

Translate

site design / logo © 2022 Grokbase