After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 671314 - dbus interface is not registered in time, causing methods on tracker-extract to fail
dbus interface is not registered in time, causing methods on tracker-extract ...
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: Extractor
git master
Other Linux
: Normal normal
: ---
Assigned To: tracker-extractor
Jamie McCracken
Depends on:
Blocks:
 
 
Reported: 2012-03-04 17:59 UTC by Karl Relton
Modified: 2012-03-05 12:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Script to do two manual method calls (415 bytes, application/octet-stream)
2012-03-04 17:59 UTC, Karl Relton
  Details
Sample results of running script in first attachment (291 bytes, text/x-log)
2012-03-04 18:01 UTC, Karl Relton
  Details
Proposed patch to fix the problem (1.44 KB, patch)
2012-03-04 18:07 UTC, Karl Relton
committed Details | Review

Description Karl Relton 2012-03-04 17:59:33 UTC
Created attachment 208958 [details]
Script to do two manual method calls

A method on tracker-extract (e.g. invoked by tracker-miner-fs) is failing with an 'unknown interface' dbus error. This occurs when the tracker-extract process is not already running. However, dbus should start tracker-extract, and once it is running call the method and pass the results back to the caller (e.g. tracker-miner-fs).

This is not always happening.

What is happening is that tracker-extract is being started successfully, but the method call is failing. A subsequent method call (with tracker-extract now already running) will succeed, so it is not a problem with dbus itself.

The above can be proved by doing the following:

- Ensure tracker-extract is not running
- Run the attached script which uses dbus-send to do two manual method calls
  - the first one fails, the second one succeeds
Comment 1 Karl Relton 2012-03-04 18:01:03 UTC
Created attachment 208959 [details]
Sample results of running script in first attachment

Shows what happens - first invocation fails (but tracker-extract process does actually start). Second invocation then succeeds.
Comment 2 Karl Relton 2012-03-04 18:07:47 UTC
Created attachment 208960 [details] [review]
Proposed patch to fix the problem

I believe the problem is that the regristration of the interface occurs too late. It is currently after the call to g_bus_own_name_on_connection().

In http://developer.gnome.org/gio/2.28/gio-Owning-Bus-Names.html#g-bus-own-name
it says:

"If you plan on exporting objects (using e.g. g_dbus_connection_register_object()), note that it is generally too late to export the objects in name_acquired_handler. Instead, you can do this in bus_acquired_handler since you are guaranteed that this will run before name is requested from the bus."

Now here we are using g_bus_own_name_on_connection() rather than the g_bus_own_name () in this bit of the documentation, but it seems to me that the principle will be the same for both functions.

Since g_bus_own_name_on_connection() implies that we already have a connection (i.e. the bus is 'acquired'), it seems to me that it would be better to register interface BEFORE we call this function, not after it.

This attached patch does that, simply swaps the order, and fixes the problem on my system. Method calls now always complete, even if tracker-extract is not already running. With my test script (1st attachment), both calls return correctly (with the same pid).
Comment 3 Karl Relton 2012-03-04 18:09:48 UTC
I should note that the presence of this issue means in practice various files don't get extracted: the method call invoked from miner-fs fails, so the mining of that file gets dropped and things move on. The tracker database is then incomplete for that file.
Comment 4 Martyn Russell 2012-03-05 08:09:41 UTC
Thanks for the patch, there are a few other places which I imagine could do with this too in the code base. I will look into this ASAP.
Comment 5 Martyn Russell 2012-03-05 12:07:44 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.

Thanks Karl, much appreciated!
Comment 6 Martyn Russell 2012-03-05 12:08:05 UTC
Comment on attachment 208960 [details] [review]
Proposed patch to fix the problem

I added some extra code to the patch, thanks again!