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 419383 - high CPU usage in GtkTreeView stuff with a11y enabled
high CPU usage in GtkTreeView stuff with a11y enabled
Status: RESOLVED OBSOLETE
Product: rhythmbox
Classification: Other
Component: general
0.9.8
Other All
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 551275 565182 (view as bug list)
Depends on: 554171
Blocks:
 
 
Reported: 2007-03-17 15:25 UTC by tierfreunde-hagenburg
Modified: 2018-05-24 12:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sysprof output (99.25 KB, text/plain)
2007-03-18 08:17 UTC, tierfreunde-hagenburg
  Details
moderately interesting patch (6.18 KB, patch)
2008-10-07 12:14 UTC, Jonathan Matthew
committed Details | Review

Description tierfreunde-hagenburg 2007-03-17 15:25:23 UTC
Please describe the problem:
I've got my music on my home server. under ubuntu feisty rb takes a lot of time to organise the allready indexed library on every start. (Watch folders disabled! Which isn't working at all. Both under feisty and edgy).



Steps to reproduce:
1. install ubuntu-feisty. put a lot of music on your local server.
2. connect via ssh2, start rhythmbox the first time, index the music, close rb.
3. start rb.


Actual results:


Expected results:


Does this happen every time?


Other information:
this here takes a lot of time:

...
(16:23:31) [0x80f4028] [rb_entry_view_row_inserted_cb] rb-entry-view.c:1703: row added
(16:23:31) [0x80f4028] [rb_shell_clipboard_entries_changed_cb] rb-shell-clipboard.c:804: entryview changed
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Heavy Metal": refcount 207
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Rammstein": refcount 11
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Mutter": refcount 11
(16:23:31) [0x80f4028] [rb_entry_view_row_inserted_cb] rb-entry-view.c:1703: row added
(16:23:31) [0x80f4028] [rb_shell_clipboard_entries_changed_cb] rb-shell-clipboard.c:804: entryview changed
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Heavy Metal": refcount 208
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "KING DIAMOND": refcount 8
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Them": refcount 8
(16:23:31) [0x80f4028] [rb_entry_view_row_inserted_cb] rb-entry-view.c:1703: row added
(16:23:31) [0x80f4028] [rb_shell_clipboard_entries_changed_cb] rb-shell-clipboard.c:804: entryview changed
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Heavy Metal": refcount 209
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Various": refcount 38
(16:23:31) [0x80f4028] [rhythmdb_property_model_insert] rhythmdb-property-model.c:599: adding "Nativity In Black - A Tribute To Black Sabbath": refcount 12
(16:23:31) [0x80f4028] [rb_entry_view_row_inserted_cb] rb-entry-view.c:1703: row added
...
Comment 1 James "Doc" Livingston 2007-03-18 01:41:08 UTC
If you could get the output of 'sysprof' or another profiling tool, that would help a lot in figuring out what is causing this. Installing the debug symbols for Rhythmbox (see https://wiki.ubuntu.com/DebuggingProgramCrash#head-dfec77613a7608500efa364c6f6f55c19bfe8aaa) would be necessary.



To install sysprof, you need to install the 'sysprof' package and then the kernel module. The kernel module is somewhat more difficult to get, you need to install "module-assistant", run "sudo m-a a-i sysprof-module" then "sudo modprobe sysprof_module".

One installed you can run "sysprof" from the terminal, press 'Start', start up Rhythmbox, wait a little while while it's using the CPU, after a few minutes press "Profile", then "Save as" and upload the resulting file.


Thanks
Comment 2 tierfreunde-hagenburg 2007-03-18 08:17:24 UTC
Created attachment 84816 [details]
sysprof output
Comment 3 Jonathan Matthew 2007-03-18 09:58:36 UTC
That sysprof output does not include debug symbols.

Is there any reason to treat this bug as a blocker?
Comment 4 tierfreunde-hagenburg 2007-03-18 10:19:26 UTC
I did, what James told me.

How can I include debug symbols?
Comment 5 James "Doc" Livingston 2007-03-25 06:59:15 UTC
Installing the following packages would help: libglib2.0-0-dbg, libc6-dbg. And following the instructions on the wiki page I posted a link to, namely adding "deb http://people.ubuntu.com/~pitti/ddebs feisty main" to your /etc/apt/source.list and then installing the "rhythmbox-dbgsym" package.

However I think I might know what this is anyway, as I've noticed something similar recently. Do you have accessability turned on for the Gnome desktop? If so, it appears to be GAIL/AT-SPI pulling huge amounts of data from our tree view. Although I've only seen this when trying to quit rhythmbox, and it takes about 45 seconds or so.
Comment 6 tierfreunde-hagenburg 2007-03-25 09:22:19 UTC
Hi,

Yes, I have accessability turned on to avoid those very ugly opening and closing boxes for windows.

Closing rhytmbox takes a longer time, too.
Comment 7 tierfreunde-hagenburg 2007-03-25 10:05:59 UTC
deactivating accessability lets rb behave correctly!!!
Comment 8 Marc Arens 2008-03-26 17:46:24 UTC
I was hit by that bug, too. But i'd say disabling accessability is just a workaround. So where is the bug located: rhythmbox or gail/at-spi?
Comment 9 Jonathan Matthew 2008-09-15 21:32:45 UTC
*** Bug 551275 has been marked as a duplicate of this bug. ***
Comment 10 Jonathan Matthew 2008-10-04 10:37:57 UTC
Looks like the main thing we need to do is to avoid having query and property models visible (attached to a view) while they're being filled.  Each row added to or modified in a visible tree model causes a synchronous corba request to the at-spi registry daemon.

I think the slowness on shutdown has more or less the same cause, but I haven't really looked into that yet.
Comment 11 Jonathan Matthew 2008-10-07 12:14:56 UTC
Created attachment 120110 [details] [review]
moderately interesting patch

This adds a property to RBBrowserSource controlling when the base query model is populated, and uses it to only build the main library query model once the database is loaded.  It also only makes query models used in browser sources visible once the backing query is complete.

The idea here is to avoid filling query models while they're visible, which is the main cause of slowness with a11y enabled.  With this patch, we load and perform searches about as quickly with a11y enabled as with it disabled.  There are some visible differences in behaviour that might make things feel a bit slower, though.
Comment 12 Jonathan Matthew 2008-10-13 22:40:20 UTC
I've committed a slightly modified version of that patch that also covers auto playlists too.  There's more to do here - browser selection changes probably aren't handled in the same way - so I'm leaving the bug open.
Comment 13 Jonathan Matthew 2008-10-16 11:36:10 UTC
shutdown time is mostly fixed:

2008-10-16  Jonathan Matthew  <jonathan@d14n.org>

        * widgets/rb-entry-view.c: (rb_entry_view_dispose):
        Remove the model from the tree view, avoiding deletion events for each
        cell when a11y is enabled; mostly fixes shutdown time.  From #419383.
Comment 14 Jonathan Matthew 2008-12-28 01:47:40 UTC
*** Bug 565182 has been marked as a duplicate of this bug. ***
Comment 15 Benny Malengier 2009-06-25 19:42:32 UTC
This bug is present in Nautilius (see https://bugs.launchpad.net/nautilus/+bug/159042 )
Also in GRAMPS: http://article.gmane.org/gmane.comp.genealogy.gramps.devel/12372 

Is there a way for an application to make sure ATK is not interfering with the treeviews?
In GRAMPS the treeview is based on  GenericTreeModel.

The solution Matthew gives:

'''Looks like the main thing we need to do is to avoid having query and property
models visible (attached to a view) while they're being filled.  Each row added
to or modified in a visible tree model causes a synchronous corba request to
the at-spi registry daemon.'''

is quite artificial for applications. 

Comment 16 Benny Malengier 2009-06-25 19:51:07 UTC
Without knowing how ATK works, as an application developer I would expect ATK only to react to the signals the GenericTreeView signals. 
If I change the entire model, ATK should do nothing as long as the app does not signal a row-changed, row-updated or row-deleted event (http://library.gnome.org/devel/pygtk/stable/class-gtktreemodel.html#method-gtktreemodel--row-changed ) 

After all, that is what those methods are for. My guess is that unattaching then reattaching a model creates quite some overhead on 4000+ treeview, compared to a row-changed event. Or not?
Comment 17 Jonathan Matthew 2009-06-26 00:10:35 UTC
This bug is about rhythmbox.  If you want to address nautilus, please open a new bug.
Comment 18 Benny Malengier 2009-06-26 07:32:55 UTC
Done: #419383 http://bugzilla.gnome.org/show_bug.cgi?id=419383 
If you have reasons to believe this bug is not related to that, please update it.

May I further suggest the gnome bug submission system puts the application somewhat more prominent on the bug pages. It is confusing for non GNOME users that there is one bug system, but that it is in reality separately managed.
Comment 19 Jonathan Matthew 2009-06-26 08:26:03 UTC
(actually the new one is bug 587020)

The accessibility subsystem is currently being redesigned and reimplemented (replacing CORBA with dbus).  I haven't looked at the new implementation in any detail, so I have no idea if it addresses this problem at all.  Start here if you're interested: http://live.gnome.org/Accessibility/BonoboDeprecation
Comment 20 Alejandro Piñeiro Iglesias (IRC: infapi00) 2009-12-10 11:34:09 UTC
Hi, I took a look to this bug as I have a similar problem in other application.

Although there are some ATK related comments in the general ATK bug managing this issue (577098), I would want to provide some extra information here: yes, several parts of the accessibility subsystem are being reimplemented in order to fulfill the bonobo deprecation, mainly the at-spi daemon. *But*, I really doubt that this could solve the problem.

The object that implements the a11y support for gtktreeview is gailtreeview. It is an AtkObject implementing some extra ATK interfaces. You can see at the line 4243, this method:

  static void
  connect_model_signals (GtkTreeView  *view,
                       GailTreeView *gailview)
  {
    GObject *obj;

    obj = G_OBJECT (gailview->tree_model);
    g_signal_connect_data (obj, "row-changed",
                           (GCallback) model_row_changed, view, NULL, 0);
    g_signal_connect_data (obj, "row-inserted",
                           (GCallback) model_row_inserted, view, NULL, 
                           G_CONNECT_AFTER);
    g_signal_connect_data (obj, "row-deleted",
                           (GCallback) model_row_deleted, view, NULL, 
                           G_CONNECT_AFTER);
    g_signal_connect_data (obj, "rows-reordered",
                           (GCallback) model_rows_reordered, view, NULL, 
                           G_CONNECT_AFTER);
  }

For example, the callback model_row_inserted make several things, among them, emit this signal:
g_signal_emit_by_name (atk_obj, "row_inserted", row, n_inserted);

This is a signal defined by the AtkTable interface:
http://library.gnome.org/devel/atk/stable/AtkTable.html#AtkTable-row-inserted

An this causes that bonobo call, in order to report the at-spi, so any a11y supporting application could know that.

GAIL is not being reimplemented due this bonobo deprecation work, so the behavior will be the same. The only difference is that with the revamped at-spi, it will be a DBUS call instead a bonobo one.
Comment 21 GNOME Infrastructure Team 2018-05-24 12:27:50 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/rhythmbox/issues/345.