[rabbitmq-discuss] pika raise NotImplementedError

gabriel adgeg gabrieladgeg at gmail.com
Tue Dec 6 14:25:06 GMT 2011


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>


More information about the rabbitmq-discuss mailing list