Argument appended DBus reply gets blocked by system bus

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Apr 6 11:35:04 PDT 2015


On 06/04/15 14:54, Prasad Bhat wrote:
> The DBus message is always received at the protocol stack and reply
> without any arguments works fine.

Then your system bus policy is probably working as desired (but is still
not quite right - see below).

> However when I try to send reply with arguments appended using
> dbus_message_append_args_valist, the message send is successful, but its
> not received at the other end. it seems it is blocked in the system bus.

Check the syslog (or the Journal on systemd systems). dbus-daemon logs a
message there every time the system bus blocks transmission of a message.

However, if a message with no arguments gets through fine, then it
probably isn't this.

> If anyone has any clue how to resolve this, please suggest me, any
> suggestion how to debug this further will be greatly helpful.

My guess is that you are not appending the arguments correctly, causing
an assertion failure (a "check failed" warning) which marks the message
as unusable. If you try to send a message that has been marked as
unusable, you'll get another assertion failure and the message will not
be sent.

Check the standard error stream of the process that is sending the
message; redirect it to a file if necessary. You can also set the
environment variable DBUS_FATAL_WARNINGS to "1" to make these checks
fatal, which will make them crash the process with abort(), at which
point you can use normal debugging tools to get a core dump and a
backtrace. By default they are fatal in upstream D-Bus and in most Linux
distributions, but non-fatal in Debian and its derivatives like Ubuntu;
at some point I should make that consistent, but I'm not sure which one
should change and which one should stay the same.

The most common cause of failed checks is trying to send a string that
is not valid UTF-8. On D-Bus, "string" means specifically means Unicode
without any U+0000 (NUL) characters, encoded in UTF-8; if you want to be
able to send arbitrary bytestrings, you must use an array of bytes instead.

> I have added this interface to the policy file as: <allow
> send_interface="org.---.---"/>
> Do I need to add anything else in the policy configuration file?

This will work, but is not correct. Please prefer to write your policies
in terms of senders and destinations, not interfaces. See
<https://lintian.debian.org/tags/dbus-policy-without-send-destination.html>
for more details.

-- 
Simon McVittie
Collabora Ltd. <http://www.collabora.com/>



More information about the dbus mailing list