FrameSyntaxError: Shortstring overflow

Hi.

I am nube. ^)

Zato 2.0.7
ubuntu 16.04.1
local RabbitMQ 3.6.5

# stdlib
from contextlib import closing
from datetime import datetime

# Zato
from zato.server.service import Service

class DBTimeServiceAMQP(Service):
    def handle(self):

         msg = "test message" 
	self.logger.info(msg)
	out_name = 'test.amqp.outconn'
	exchange = 'zato.test.in'
	routing_key = ''
	properties = {'app_id': 'ESB'}
	headers = {'X-Foo': 'bar'}
	self.outgoing.amqp.send(msg, out_name, exchange, routing_key, properties, headers)

Error in details

Summary

2016-09-02 11:40:45,152 - ERROR - 32212:Thread-3 - zato.server.base:22 - Could not handle broker msg:[Bunch(action=u’100803’, args=[], body=u’test message’, exchange=u’zato.test.in’, headers={‘X-Zato-Msg-TS’: ‘2016-09-02T08:40:45.147682’, u’X-Foo’: u’bar’, ‘X-Zato-Component’: u’out-amqp/zato/zato/32212/MainThread’}, kwargs={}, msg_type=u’0003’, out_name=u’test.amqp.outconn’, properties={u’app_id’: u’ESB’}, routing_key=u’’)], e:[Traceback (most recent call last):

Summary

File “/opt/zato/2.0.7/zato-server/src/zato/server/base/init.py”, line 47, in on_broker_msg

Summary

getattr(self, handler)(msg)

Summary

File “/opt/zato/2.0.7/zato-server/src/zato/server/connection/amqp/outgoing.py”, line 219, in on_broker_msg_OUTGOING_AMQP_PUBLISH

Summary

producer.publish(msg.body, retry=True, routing_key=msg.routing_key, exchange=msg.exchange, headers=headers, **properties)

Summary

File “/opt/zato/2.0.7/eggs/kombu-3.0.35-py2.7.egg/kombu/messaging.py”, line 172, in publish

Summary

routing_key, mandatory, immediate, exchange, declare)

Summary

File “/opt/zato/2.0.7/eggs/kombu-3.0.35-py2.7.egg/kombu/connection.py”, line 436, in _ensured

Summary

return fun(*args, **kwargs)

Summary

File “/opt/zato/2.0.7/eggs/kombu-3.0.35-py2.7.egg/kombu/messaging.py”, line 188, in _publish

Summary

mandatory=mandatory, immediate=immediate,

Summary

File “/opt/zato/2.0.7/eggs/amqp-1.4.9-py2.7.egg/amqp/channel.py”, line 2123, in _basic_publish

Summary

self._send_method((60, 40), args, msg)

Summary

File “/opt/zato/2.0.7/eggs/amqp-1.4.9-py2.7.egg/amqp/abstract_channel.py”, line 56, in _send_method

Summary

self.channel_id, method_sig, args, content,

Summary

File “/opt/zato/2.0.7/eggs/amqp-1.4.9-py2.7.egg/amqp/method_framing.py”, line 219, in write_method

Summary

properties = content._serialize_properties()

Summary

File “/opt/zato/2.0.7/eggs/amqp-1.4.9-py2.7.egg/amqp/serialization.py”, line 499, in _serialize_properties

Summary

getattr(raw_bytes, ‘write_’ + proptype)(val)

Summary

File “/opt/zato/2.0.7/eggs/amqp-1.4.9-py2.7.egg/amqp/serialization.py”, line 326, in write_shortstr

Summary

‘Shortstring overflow ({0} > 255)’.format(len(s)))

Summary

FrameSyntaxError: Shortstring overflow (4000 > 255)

Why?

Thx.

Hello @prosoft,

there was an issue with how expiration in AMQP messages was handled, in particular, instead of being an integer, it was a string.

This meant that the underlying kombu library could not really deal with it.

For instance, instead of …

5000 * 1000 = 5 # 5 seconds

… it was doing:

‘5000’ * 1000 = a really long string instead of an integer 5.

It was fixed in this commit and will be released in 2.0.8: