[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Unable to connect to dbus socket.



Hello,

I am currently fixing some bugs in a program I want to maintain the package of in the future. Most of the work is done but there is one bug I'm just not sure of it's in the program or in d-bus.

The program is a gnome panel applet that calls libnotify_init() on startup. It works fine when I first login (say after a reboot) but then when I logout and login again libnotify_init() fails. This doesn't always happen, but it happens about 95% of the time.

I've tracked it down to the point where the following code generates an error:

GError* error = NULL;
DBusGConnection* bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
if (error != NULL)
{
    throw std::runtime_error(error->message);
}

This is a slightly modified version of the code that is in libnotify_init() which I put in my own program to redirect the output (error->message) to a logfile because I wasn't sure how to redirect g_message() (which is what the code in libnotify_init() uses to output the error). The logfile looks like this:

ERROR: Failed to connect to socket /tmp/dbus-fgcckjDDZP: Verbinding is geweigerd
LOG: LibNotify constructor called (this = 0x9bb1c14)
ERROR: Failed to connect to socket /tmp/dbus-fgcckjDDZP: Verbinding is geweigerd
LOG: LibNotify constructor called (this = 0x9ca1c14)
ERROR: Failed to connect to socket /tmp/dbus-fgcckjDDZP: Verbinding is geweigerd
LOG: LibNotify constructor called (this = 0x8f17c14)
ERROR: Failed to connect to socket /tmp/dbus-fgcckjDDZP: Verbinding is geweigerd
LOG: LibNotify constructor called (this = 0x8f21c6c)
ERROR: Failed to connect to socket /tmp/dbus-fgcckjDDZP: Verbinding is geweigerd
...etc

The LOG messages come from another line of code. It's the ERROR message that is coming from std::runtime_error(error->message). "Verbinding is geweigerd" is Dutch for "Connection refused". The log file is an accumulation of multiple runs of the program, it's not erased when the program is restarted. So for every ERROR in the log file there is 1 run of the program (one logout and login).

Can anybody help me with this? Is this a bug in the program or is it a bug in d-bus? If it's in d-bus, can I work around this?

These results are in Debian unstable x86.

Thanks in advance.

Regards,
Guido Loupias


Reply to: