Re: [Tracker] [Patch] DBus connection lost handling



Laurent Aguerreche wrote:
Hello,

currently, when DBus connection goes down trackerd exits with status set
to 1. The culprit is dbus-daemon that runs as a per-user session
process. When it goes down trackerd follows.

A DBus aware process can avoid this exit with:
dbus_connection_set_exit_on_disconnect (connection, FALSE);
(It is required because dbus_bus_get() always set 'exit_on_disconnect'
to TRUE otherwise it would stay to FALSE)

Now trackerd doesn't crash anymore when it looses its connection to
DBus... but it won't be able to reconnect to DBus anymore, so trackerd
has to be shut down.
In fact, it is also useful to make trackerd exits on a DBus
disconnection because GNOME, KDE, XFCE, whatever, runs a dbus daemon
that will exit at end of session. Therefore treackerd is currently
crashing at end of session (look at trackerd's logs).

It is possible to catch the 'disconnected' signal from DBus and to make
trackerd exiting after a DBus disconnection. I propose a patch that
implement this idea.
But this patch is not very clean... I added a DBUS_ACTION named
DBUS_ACTION_DBUS_DISCONNECTED.

This should not be necessary as dbus methods and signals are *initially* handled in the main thread (as are all signals/notifications like inotify/fam)

Ergo all thats needed is to call :

tracker_log ("DBus connection has been lost, trackerd will shutdown");
tracker->is_running = FALSE;
tracker_end_watching ();
tracker_do_cleanup ();

(move do_cleanup to tracker-utils.c/.h and make it non static. We can probably use tracker->is_running instead of static shutdown variable in trackerd.c too?)

do_cleanup does not need to be in a timeout as we are not interrupting the code in this case (the dbus signal is notified via the glib main loop so will be handled in idle time and never in the middle of a function!)

This should mean that trackerd is terminated asap and avoid being queued behind existing dbus actions which could hang/timeout if existing dbus actions were already in the queue and dbus session bus was killed.

Anyway great stuff - please send an amended patch


jamie.




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