I made a simple D-BUS server which writes a line into a file when it receives a message and a client which sends 100 messages to the server with the auto-activate flag up in every one of them. The server is not initially running (it's supposed to be activated by the first message). The D-BUS system bus is used and proper .service and .conf files are installed for the server. When the client is run, one of the two things happen: 1) D-BUS system bus crashes (the server is not activated). 2) Another(!) D-BUS system bus appears to ps command's listing and the server is activated, but the server does not receive any of the 100 messages. In case of 2) happened and the client is run again, the server receives all the 100 messages (but there's still two D-BUS system buses running, according to ps).
Created attachment 497 [details] Test server and client + .service and .conf files used
Hmm, works fine for me, using current CVS version and testing with the session bus instead of the system bus.
I tested it again with v0.21 session bus and the same bug is there, so it must be fixed in the CVS version.
Tested this with D-BUS CVS version (dated 21 Jul 04) and strange things happened (server not up, session bus running, only 5 messages with auto-activation flag set): kihamala@mylly:~/dbus-test/act-test-progs$ ./bug_client service bug.svc does not exist message 1 was put into the queue message 2 was put into the queue message 3 was put into the queue message 4 was put into the queue message 5 was put into the queue Message sent kihamala@mylly:~/dbus-test/act-test-progs$ Fd 4 did not have the close-on-exec flag set! Fd 5 did not have the close-on-exec flag set! 22758: assertion failed "sitter != NULL" file "dbus-spawn.c" line 244 Error when connecting to the session bus: Disconnected prior to receiving a reply [1]+ Aborted ./dbus-daemon-1 --session --print-address (wd: ~/dbus-prefix/bin) (wd now: ~/dbus-test/act-test-progs) I.e. the session bus crashed. Strange thing is that the bus does not crash if I comment out line 43 from the client, where I set the auto-activation flag (but of course does not launch the server either). I'll attach the source code soon.
Created attachment 511 [details] test server and client + .service file for activating the server client resided in: /home/kihamala/dbus-test/act-test-progs server resided in (as specified in .service file): /home/kihamala/dbus-test D-BUS daemon (CVS version 21th Jul 04) resided in: /home/kihamala/dbus-prefix/bin Ldd output for bug_client: kihamala@mylly:~/dbus-test/act-test-progs$ ldd bug_client libdbus-1.so.0 => /home/kihamala/dbus-prefix/lib/libdbus-1.so.0 (0x40018000) libdbus-glib-1.so.0 => /home/kihamala/dbus-prefix/lib/libdbus-glib-1.so.0 (0x4007c000) libc.so.6 => /lib/libc.so.6 (0x40092000) libnsl.so.1 => /lib/libnsl.so.1 (0x401c6000) libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x401db000) libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x40214000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
OK, there are several issues. First, we have the same problem as bug #894 , ie the daemon loses the last messages when the client exits. As for the assertion failure, here comes a patch. Then, about the message loss, what's happenning is that, by the time the server has spawn, registered with bus and acquired its service, the client has exited. The problem is that in the case of auto-activation message, policy checking is delayed until the server is up. So when the daemon wants to send the delayed messages with the auto-activation flag, the client connection is dead, so it cannot check the policy and it just bins these messages.
Created attachment 512 [details] [review] fix first hunk is a cheap optimization, second hunk fixes the bug
Created attachment 518 [details] [review] cleaner fix Basically, ignore the HANGUP condition
#$%!£ I posted in the wrong bug. Sorry, that's for bug #894
Comment on attachment 518 [details]