You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Gordon Sim (JIRA)" <ji...@apache.org> on 2013/02/15 15:17:12 UTC

[jira] [Commented] (QPID-4583) python-qpid limits map element size to 65535 bytes

    [ https://issues.apache.org/jira/browse/QPID-4583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13579201#comment-13579201 ] 

Gordon Sim commented on QPID-4583:
----------------------------------

The largest string type in amqp 0-10 is str16 which is indeed limited to 2^16 in length. Larger values can be encoded as vbin32. To signal that the value should be treated as binary in this way you can wrap it with buffer(value). E.g. the reproducer attached could be modified as

{noformat}
--- ./reproducer.py.orig	2013-02-15 14:00:28.294263872 +0000
+++ ./reproducer.py	2013-02-15 14:01:11.833266232 +0000
@@ -17,11 +17,15 @@ a_map = json.loads(a_template)
 # If any key is > 2^16 bytes, str16 encoding fails
 for key in a_map:
     print "SHDEBUG len(str(a_map[%s])) = %s" % (key, len(str(a_map[key])))
+    if len(str(a_map[key])) > 65534:
+        a_map[key] = buffer(a_map[key])
+        print "encoding value of length %s as binary for key %s" % (len(str(a_map[key])), key)
 print "SHDEBUG created a_map, type=%s" % type(a_map)
 
 sender.send(Message(content=a_map))
 
 message = receiver.fetch(timeout=1)
+print message.content
 session.acknowledge()
 
 connection.close()
{noformat}

I propose closing this as not-a-bug. Does that seem reasonable?
                
> python-qpid limits map element size to 65535 bytes
> --------------------------------------------------
>
>                 Key: QPID-4583
>                 URL: https://issues.apache.org/jira/browse/QPID-4583
>             Project: Qpid
>          Issue Type: Bug
>          Components: Python Client
>    Affects Versions: 0.20
>         Environment: Tested on Fedora 17, python-qpid-0.20-1.fc17.noarch
>            Reporter: Steven Hardy
>            Assignee: Gordon Sim
>
> It seems that we hit a limit of 65535 bytes when encoding a map via python-qpid, because the map elements are encoded as a str16 (write_map in codec010.py)
> Looking at the amqp 0-10 spec, it says "An encoded map may contain up to (4294967295 - 4) octets worth of encoded entries.", and I don't see any specified limit for individual map elements.  This limitation does not appear to exist when testing on rabbitmq, so I'm wondering if it's possible to work out a way to remove this limit when using qpid.
> Reproducer:
> git clone https://gist.github.com/hardys/4951857
> cd 4951857
> python reproducer.py

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org