We experience some problems with dbus. We have a java application, when the application enters the dbus, the dbus-monitor quits. First we were thinking that there were problems in the java bindings, but it is not. I also noticed the following post on this mailinglist a few years ago: <a href="http://web.archiveorange.com/archive/v/2mxmYltly6ixKYVh5MJe">http://web.archiveorange.com/archive/v/2mxmYltly6ixKYVh5MJe</a> that describes the same problem as we have, but as we are developing on the latest debian stable 6.0 the issue seems not to be solved, maybe because it is rarely seen.<br>
<br>I start first the dbus daemon in a private session<br>then listen with dbus-monitor<br>as 3th launch the java application. <br><br>This causes the dbus-monitor to exit because of the lenghts in the fields are not corrrect.<br>
The java application sends following data to the dbus layer:<br><br>RequestName to dbus-daemon<br>0042 42 01 00 01 00 00 00 18 00 00 00 02 00 00 j.B..... ........<br>0050 00 80 01 01 6f 00 00 00 00 15 2f 6f 72 67 2f 66 ....o... ../org/f<br>
0060 72 65 65 64 65 73 6b 74 6f 70 2f 44 42 75 73 00 reedeskt op/DBus.<br>0070 00 00 06 01 73 00 00 00 00 14 6f 72 67 2e 66 72 ....s... ..<a href="http://org.fr">org.fr</a><br>0080 65 65 64 65 73 6b 74 6f 70 2e 44 42 75 73 00 00 eedeskto p.DBus..<br>
0090 00 00 02 01 73 00 00 00 00 14 6f 72 67 2e 66 72 ....s... ..<a href="http://org.fr">org.fr</a><br>00a0 65 65 64 65 73 6b 74 6f 70 2e 44 42 75 73 00 00 eedeskto p.DBus..<br>00b0 00 00 03 01 73 00 00 00 00 0b 52 65 71 75 65 73 ....s... ..Reques<br>
00c0 74 4e 61 6d 65 00 00 00 00 00 08 01 67 00 02 73 tName... ....g..s<br>00d0 75 00 00 00 00 0c 74 65 73 74 2e 73 65 72 76 69 u.....te st.servi<br>00e0 63 65 00 00 00 00 00 00 00 06 ce...... .. <br>
<br><br>As you can see this is big endian<br><br>The dbus-daemon sends the same message to the monitor (who is in little endian format)<br><br>0042 42 01 00 01 18 00 00 00 02 00 00 00 8e 00 j.B..... ........<br>0050 00 00 01 01 6f 00 15 00 00 00 2f 6f 72 67 2f 66 ....o... ../org/f<br>
0060 72 65 65 64 65 73 6b 74 6f 70 2f 44 42 75 73 00 reedeskt op/DBus.<br>0070 00 00 06 01 73 00 14 00 00 00 6f 72 67 2e 66 72 ....s... ..<a href="http://org.fr">org.fr</a><br>0080 65 65 64 65 73 6b 74 6f 70 2e 44 42 75 73 00 00 eedeskto p.DBus..<br>
0090 00 00 02 01 73 00 14 00 00 00 6f 72 67 2e 66 72 ....s... ..<a href="http://org.fr">org.fr</a><br>00a0 65 65 64 65 73 6b 74 6f 70 2e 44 42 75 73 00 00 eedeskto p.DBus..<br>00b0 00 00 03 01 73 00 0b 00 00 00 52 65 71 75 65 73 ....s... ..Reques<br>
00c0 74 4e 61 6d 65 00 00 00 00 00 08 01 67 00 02 73 tName... ....g..s<br>00d0 75 00 07 01 73 00 05 00 00 00 3a 31 2e 33 35 00 u...s... ..:1.35.<br>00e0 00 00 0c 00 00 00 74 65 73 74 2e 73 65 72 76 69 ......te st.servi<br>
00f0 63 65 00 00 00 00 06 00 00 00 ce...... .. <br><br><br>The problem is that the lengths are in little endian but the field indicates big endian.<br><br>This happens only with some method calls, for example the Hello call does not have the problem. We can reproduce this 100%. <br>
<br>The java application we use has the following code:<br><br>import org.freedesktop.dbus.DBusConnection;<br>import org.freedesktop.dbus.exceptions.DBusException;<br><br><br>public class DbusTester {<br><br> DBusConnection conn;<br>
<br> public DbusTester(String dbusAddress) throws DBusException {<br> conn = DBusConnection.getConnection(dbusAddress);<br> }<br> <br> public void execute() throws Exception {<br>
conn.requestBusName("test.service");<br> // stay alive for a while<br> Thread.sleep(5000);<br> }<br> <br> public void exit() {<br> if (conn != null) conn.disconnect();<br>
}<br> <br> public static void main(String[] args) {<br> DbusTester dbusTest = null;<br> try {<br> if (args.length == 0) {<br> System.out.println("usage: DbusTest <dbusAddress>");<br>
}<br> dbusTest = new DbusTester(args[0]);<br> dbusTest.execute();<br> }<br> catch (Exception e) {<br> e.printStackTrace();<br>
}<br> finally {<br> if (dbusTest != null) dbusTest.exit();<br> }<br> }<br>}<br><br><br><br>