rstream icon indicating copy to clipboard operation
rstream copied to clipboard

AMQP encoder does not handle large integers

Open wrobell opened this issue 1 year ago • 2 comments

I would like to update RbFly performance tests for AMQP codecs (https://wrobell.dcmod.org/rbfly/performance.html), but it seems the encoder you are using does not support large integers, so the bug report

The following

from rstream.amqp import AMQPMessage
bytes(AMQPMessage(body={'large-int': 2 ** 32 + 1}))

results in

File ~/projects/rbfly/.venv/lib/python3.12/site-packages/rstream/_pyamqp/_encode.py:262, in encode_int(output, value, with_constructor, use_smallest)
    260     output.extend(struct.pack(">i", value))
    261 except struct.error as exc:
--> 262     raise ValueError("Value supplied for int invalid: {}".format(value)) from exc

ValueError: Value supplied for int invalid: 4294967297

wrobell avatar Oct 11 '24 01:10 wrobell

Thank you @wrobell we will have a look as soon as poosible

Gsantomaggio avatar Oct 17 '24 06:10 Gsantomaggio

Hi @wrobell

this branch should solve the issue: https://github.com/qweeze/rstream/pull/214

Could you test it?

Thanks, Daniele

DanielePalaia avatar Oct 24 '24 13:10 DanielePalaia

fixed via https://github.com/rabbitmq-community/rstream/pull/240

Gsantomaggio avatar Sep 05 '25 07:09 Gsantomaggio