[rabbitmq-discuss] Python AMQPLib causes exception when trying to declare queue with X-Expires

Stephen Day stevvooe at gmail.com
Sun Aug 29 09:50:01 BST 2010

Here is the traceback showing the exception as thrown by amqplib, with
the channel exception code:

>>> ch.queue_declare('bdirect', arguments={"x-expires": 600})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/amqplib/client_0_8/channel.py",
line 1294, in queue_declare
    (50, 11),    # Channel.queue_declare_ok
  File "/usr/lib/pymodules/python2.6/amqplib/client_0_8/abstract_channel.py",
line 105, in wait
    return amqp_method(self, args)
  File "/usr/lib/pymodules/python2.6/amqplib/client_0_8/channel.py",
line 273, in _close
    (class_id, method_id))
amqplib.client_0_8.exceptions.AMQPChannelException: (406,
u"PRECONDITION_FAILED - invalid arg 'x-expires' for queue 'bdirect' in
vhost '/': expires_not_of_type_long", (50, 10),

In the library code, it looks like it properly packs the integer, but
0-8 doesn't support the desired integer type:


372             elif isinstance(v, (int, long)):
373                 table_data.write('I')
374                 table_data.write(pack('>i', v))

The problem might actually lie in the server side parser code:


99 parse_field_value(<<"l", Value:64/signed, Rest/binary>>) ->
100     {long, Value, Rest};

The 0-8 specification doesn't define a long type outside of the "I"
type, so this excludes this feature (which is a *great* feature) from
older clients.

You should probably just have x-expires look for a regular 0-8
supported, 4-byte "I"-type integer. It will limit queue time expiry
maximum to 68 years, but one has to make design tradeoffs every once
and awhile ;).

Good work on the 2.0 release. Its looking fantastic thus far.


More information about the rabbitmq-discuss mailing list