Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If value passed to 'x-message-ttl' is greater than or equal 128, then invalid Negative value is sending to server #204

Open
vartagg opened this issue Jun 4, 2019 · 3 comments

Comments

@vartagg
Copy link

vartagg commented Jun 4, 2019

Steps to reproduce

If try something like this (pass 128 value):

transport, protocol = await aioamqp.connect(**rabbit)
channel: Channel = await protocol.channel()
arguments = {'x-message-ttl': 128}
await channel.queue_declare(queue_name='foo', durable=True, arguments=arguments)

Then this error happened:

aioamqp.exceptions.ChannelClosed: (406, "PRECONDITION_FAILED - invalid arg 'x-message-ttl' for queue 'foo' in vhost '/': {value_negative,-128}")

And if try with 129 value:

transport, protocol = await aioamqp.connect(**rabbit)
channel: Channel = await protocol.channel()
arguments = {'x-message-ttl': 129}
await channel.queue_declare(queue_name='foo', durable=True, arguments=arguments)

Then this error happened:

aioamqp.exceptions.ChannelClosed: (406, "PRECONDITION_FAILED - invalid arg 'x-message-ttl' for queue 'foo' in vhost '/': {value_negative,-127}")

130 -> -126
131 -> -125 etc..

Environment

OS: MacOS 10.14
Python: 3.7.3
Package version: aioamqp==0.13.0
RabbitMQ 3.7.13 on Erlang 21.3

@vartagg vartagg changed the title If value passed to 'x-message-ttl' is greater than or equal 128, then invalid Negative value sent to server If value passed to 'x-message-ttl' is greater than or equal 128, then invalid Negative value is sending to server Jun 4, 2019
@vartagg
Copy link
Author

vartagg commented Jun 4, 2019

I also found similar issues for client libraries in other languages. For example, this one for NodeJS:

amqp-node/amqplib#165

They resolved it by this way https://github.com/squaremo/amqp.node/pull/166/files

Also this bug is reproduced in aio-pika, when I switched the code to it.

@dzen
Copy link
Contributor

dzen commented Jun 4, 2019

Hello @vartagg

since a few versions we've migrated the frame encoding and decoding to pamqp : https://github.com/gmr/pamqp

imho we should open an issue there.
Spec says : https://www.rabbitmq.com/ttl.html

The value of the TTL argument or policy must be a non-negative integer (0 <= n), describing the TTL period in milliseconds. Thus a value of 1000 means that a message added to the queue will live in the queue for 1 second or until it is delivered to a consumer. The argument can be of AMQP 0-9-1 type short-short-int, short-int, long-int, or long-long-int.

@vartagg
Copy link
Author

vartagg commented Jun 5, 2019

since a few versions we've migrated the frame encoding and decoding to pamqp : https://github.com/gmr/pamqp

imho we should open an issue there.

Hi @dzen I need to do some investigations of this library and AMQP protocol itself, for be able to properly describe the issue in low-level terms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants