Is there a hard limit on dbus string size?
ryanh at dneg.com
Thu Apr 15 04:30:09 PDT 2010
Simon and Will,
Sorry, juggling a lot here. I overlooked that in the docs (how? I'll
RTFM better next time) :-) Thanks for pointing it out.
Well, I imagine 1-3 MB would be the absolute worst case scenario. I just
wanted to put some error handling on the server side. I think a typical
string size would be in the ballpark of 5-250k.
What I've got is a model-view-controller design. A graphics program (the
controller and the first view) is communicating with a persistent and
interactive rendering program (the 2nd view). They're both reading from
the same geometric data set (the model). Now I want to send commands to
the interactive rendering program (the 2nd view) via dbus to change the
way the model is viewed/rendered (lighting, shading, and etc.). I'd like
to send the commands in the rendering program's native format as I don't
want that process burning cycles on anything but keeping the rendering
as interactive as possible. The other alternative would be to send the
data as variants and unpack and reformat them on the client's (the
rendering program's) side, which I think would be too costly. If I
separate the commands into individual ones and send them one at a time,
the strings should stay in the 1-2K range, which I am hoping will not
starve the rendering program. Does that sound like a more reasonable use
of dbus? :-)
BTW, as a new user of dbus, I've got to say it rocks!
Simon McVittie wrote:
> On Thu, 15 Apr 2010 at 10:48:50 +0100, Will Thompson wrote:
>> On 15/04/10 10:36, Ryan Heniser wrote:
>>> Can't find it in the docs. So, I'd assume the size is limited by memory
>>> size, like most string implementations.
> <http://dbus.freedesktop.org/doc/dbus-specification.html> says:
> "Given all this, the types are marshaled on the wire as follows:
> STRING. A UINT32 indicating the string's length in bytes excluding its
> terminating nul, followed by non-nul string data of the given length,
> followed by a terminating nul byte."
> so you have a 2**32 byte limit imposed by the serialization format; but in a
> D-Bus message,
> "The maximum length of a message, including header, header alignment
> padding, and body is 2 to the 27th power or 134217728"
> which is 128MB.
> The default session bus configuration allows messages this large (actually
> larger, but I suspect the 128MB limit is also enforced):
> <limit name="max_message_size">1000000000</limit>
> but the default system bus configuration does not override the hard-coded
> default of 32MB, which limits it further:
> parser->limits.max_message_size = _DBUS_ONE_MEGABYTE * 32;
> (yes, this would be more visible if system.conf explicitly repeated all the
> default settings).
>> (But I'm suspicious of passing 3MB strings over D-Bus. :))
> What Will said - there is likely to be a way to do this that doesn't involve
> copying the string into the D-Bus daemon, then back out into the client,
> checking it for UTF-8 validity at each step.
> dbus mailing list
> dbus at lists.freedesktop.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dbus