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 704619 - Seahorse search provider comes up empty for the first search
Seahorse search provider comes up empty for the first search
Status: RESOLVED FIXED
Product: seahorse
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Seahorse Maintainer
Seahorse Maintainer
Depends on:
Blocks:
 
 
Reported: 2013-07-20 21:14 UTC by Giovanni Campagna
Modified: 2015-07-14 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
common: add a loaded property to SeahorseBackend (8.26 KB, patch)
2013-07-20 21:14 UTC, Giovanni Campagna
none Details | Review
search provider: wait until all backends are loaded before serving requests (5.45 KB, patch)
2013-07-20 21:14 UTC, Giovanni Campagna
none Details | Review
search provider: keep application alive for dbus calls (4.17 KB, patch)
2013-07-20 21:14 UTC, Giovanni Campagna
none Details | Review
Recognize and filter invalid GObject pointers (2.65 KB, patch)
2013-07-20 21:14 UTC, Giovanni Campagna
needs-work Details | Review
Application: unbreak the search provider (2.54 KB, patch)
2015-03-08 22:05 UTC, Giovanni Campagna
none Details | Review
Double the inactivity timeout (1.05 KB, patch)
2015-03-08 22:05 UTC, Giovanni Campagna
none Details | Review

Description Giovanni Campagna 2013-07-20 21:14:13 UTC
If just open the overview and start typing, the first time you
won't get any results. This is because the GetInitialResultSet
call happens when the backends are not loaded yet.
The following patch set changes it so that requests happening
too early are queued until ready.

For some reason, a cold GIRS call takes around 25 seconds here,
so it timeouts with the default GDBusProxy timeout. Attaching
a GDB hints to avahi-client, but manually invoking the avahi
methods is fast, so maybe it's some other library blocking
libdbus.
Comment 1 Giovanni Campagna 2013-07-20 21:14:16 UTC
Created attachment 249715 [details] [review]
common: add a loaded property to SeahorseBackend

All backends initialize asynchronously, but some of the users
(in particular SeahorseSearchProvider) might want to know when
the backends are fully populated before the access the collections.
Comment 2 Giovanni Campagna 2013-07-20 21:14:27 UTC
Created attachment 249716 [details] [review]
search provider: wait until all backends are loaded before serving requests

Queue all GetInitialResultSet calls that happen before all backends
are loaded, and reply to them when ready.
Comment 3 Giovanni Campagna 2013-07-20 21:14:37 UTC
Created attachment 249717 [details] [review]
search provider: keep application alive for dbus calls

If we don't do so, we get the default timeout of 10 seconds
(due to IS_SERVICE), and the inactivity timeout never starts.
Also, we don't know how long it takes for async loading of
backends, and we don't want to trigger NoReply errors.
Comment 4 Giovanni Campagna 2013-07-20 21:14:48 UTC
Created attachment 249718 [details] [review]
Recognize and filter invalid GObject pointers

We can't even run G_IS_OBJECT() on untrusted pointers, because
that reads the GTypeClass pointer. Instead, use mincore() to
determine if a pointer is valid in our address space or not.
Comment 5 Stef Walter 2013-07-24 15:36:55 UTC
Review of attachment 249718 [details] [review]:

Starting off with this bit...  I think it would be far better to keep a GHashTable of valid returned objects in the search provider. You can do this with g_object_weak_ref() and g_object_weak_unref() and friends.
Comment 6 Giovanni Campagna 2015-03-08 22:05:15 UTC
Created attachment 298836 [details] [review]
Application: unbreak the search provider

It must be initialized after backends are registered, otherwise
it will always report 0 secrets.
Comment 7 Giovanni Campagna 2015-03-08 22:05:19 UTC
Created attachment 298837 [details] [review]
Double the inactivity timeout

Even on fast storage it takes some time to load all keyrings
and certificates, which means the first search after started
is slow. Mitigate this by reducing how often the daemon is
unloaded.
Comment 8 Giovanni Campagna 2015-03-08 22:06:21 UTC
The object handle problem was fixed, would it be possible to have a review on the other patches?
Otherwise the search provider as it currently stands is completely broken.
Comment 9 Stef Walter 2015-07-14 19:58:19 UTC
Attachment 249715 [details] pushed as 60b63a9 - common: add a loaded property to SeahorseBackend
Attachment 249716 [details] pushed as efaa15c - search provider: wait until all backends are loaded before serving requests
Attachment 249717 [details] pushed as e1263e9 - search provider: keep application alive for dbus calls
Attachment 298836 [details] pushed as 7d05d9f - Application: unbreak the search provider
Attachment 298837 [details] pushed as b6c9c01 - Double the inactivity timeout