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 426987 - Panel freezes after upgrading gtk icon cache
Panel freezes after upgrading gtk icon cache
Status: VERIFIED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkRecent
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Emmanuele Bassi (:ebassi)
Depends on:
Blocks:
 
 
Reported: 2007-04-06 16:44 UTC by Fryderyk Dziarmagowski
Modified: 2007-07-20 12:01 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
valgrind log (23.70 KB, text/x-log)
2007-05-13 11:48 UTC, Fryderyk Dziarmagowski
  Details
end of a strace of gnome-panel before freeze - I have a bigger 1.1MB version too (24.92 KB, text/plain)
2007-06-29 13:22 UTC, Mart Raudsepp
  Details
Remove the icon cache from the GtkRecentManager (5.12 KB, patch)
2007-06-29 14:57 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Fryderyk Dziarmagowski 2007-04-06 16:44:17 UTC
$Subject says all.
gtk-update-icon-cache is called by post/postun rpm scripts.
Only killing (restarting) panel fixes the problem.
gdb says:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210578736 (LWP 10542)]
_int_malloc (av=0xb7f42180, bytes=10) at malloc.c:4054
4054            bck->fd = bin;
(gdb) thread apply all bt

Thread 1 (Thread -1210578736 (LWP 10542))

  • #0 _int_malloc
    at malloc.c line 4054
  • #1 *__GI___libc_malloc
    at malloc.c line 3468
  • #2 IA__g_malloc
    at gmem.c line 131
  • #3 IA__g_strdup
    at gstrfuncs.c line 91
  • #4 IA__gtk_rc_get_style
    at gtkrc.c line 1955
  • #5 gtk_widget_reset_rc_style
    at gtkwidget.c line 4809
  • #6 reset_rc_styles_recurse
    at gtkwidget.c line 5343
  • #7 gtk_fixed_forall
    at gtkfixed.c line 453
  • #8 IA__gtk_container_forall
    at gtkcontainer.c line 1261
  • #9 reset_rc_styles_recurse
    at gtkwidget.c line 5346
  • #10 gtk_bin_forall
    at gtkbin.c line 133
  • #11 IA__gtk_container_forall
    at gtkcontainer.c line 1261
  • #12 reset_rc_styles_recurse
    at gtkwidget.c line 5346
  • #13 gtk_table_forall
    at gtktable.c line 931
  • #14 IA__gtk_container_forall
    at gtkcontainer.c line 1261
  • #15 reset_rc_styles_recurse
    at gtkwidget.c line 5346
  • #16 gtk_bin_forall
    at gtkbin.c line 133
  • #17 IA__gtk_container_forall
    at gtkcontainer.c line 1261
  • #18 reset_rc_styles_recurse
    at gtkwidget.c line 5346
  • #19 IA__gtk_widget_reset_rc_styles
    at gtkwidget.c line 5356
  • #20 gtk_rc_reset_widgets
    at gtkrc.c line 1589
  • #21 reset_styles_idle
    at gtkicontheme.c line 603
  • #22 g_idle_dispatch
    at gmain.c line 3928
  • #23 IA__g_main_context_dispatch
    at gmain.c line 2045
  • #24 g_main_context_iterate
    at gmain.c line 2677
  • #25 IA__g_main_loop_run
    at gmain.c line 2881
  • #26 IA__gtk_main
    at gtkmain.c line 1154
  • #27 main
    at main.c line 98

Comment 1 Vincent Untz 2007-05-12 21:29:14 UTC
Can you run the panel in valgrind and try to reproduce the crash? It looks like memory corruption.
Comment 2 Fryderyk Dziarmagowski 2007-05-13 11:47:32 UTC
I can't reproduce crash running panel in valgrind (it keeps running), but valgrind clearly shows (884, last lines in log) some memory problem after updating icon cache and accessing menu directly after.
Comment 3 Fryderyk Dziarmagowski 2007-05-13 11:48:01 UTC
Created attachment 88113 [details]
valgrind log
Comment 4 Vincent Untz 2007-05-13 12:20:24 UTC
Could be related.

Moving to GTK+.

Here are the relevant lines:

==884== Invalid write of size 4
==884==    at 0x41215E78: get_cached_icon (gtkrecentmanager.c:1978)
==884==  Address 0x40BBFCC is 4 bytes inside a block of size 8 free'd
==884==    at 0x4005208: free (vg_replace_malloc.c:233)
==884==    by 0x4FF17D6B: g_free (gmem.c:187)
==884==    by 0x41215D53: icon_cache_element_free (gtkrecentmanager.c:1921)
==884==    by 0x4FF04B42: g_hash_table_remove_all (ghash.c:468)
==884==    by 0x4FF04BE5: g_hash_table_destroy (ghash.c:221)
==884==    by 0x4FEFE241: g_datalist_id_set_data_full (gdataset.c:282)
==884==    by 0x4FF8605F: g_object_set_data_full (gobject.c:1880)
==884==    by 0x41215DDA: icon_theme_changed (gtkrecentmanager.c:1935)
==884==    by 0x4FF7F967: g_closure_invoke (gclosure.c:490)
==884==    by 0x4FF94460: signal_emit_unlocked_R (gsignal.c:2440)
==884==    by 0x4FF95395: g_signal_emit_valist (gsignal.c:2199)
==884==    by 0x4FF95660: g_signal_emit (gsignal.c:2243)
Comment 5 Fryderyk Dziarmagowski 2007-06-27 16:06:57 UTC
ping
Comment 6 Emmanuele Bassi (:ebassi) 2007-06-27 16:34:30 UTC
(In reply to comment #5)
> ping

I can't reproduce. the recent files code keeps a cache of the icon for the mime type of the files, to avoid hitting the disk multiple times; this cache is released on the GtkIconTheme::changed signal, which should be emitted when the icon theme changes or the cache is regenerated.

valgrind is reporting that the cache is correctly cleared, but there's an access afterwards, which is weird as the following access should generate a new cache entry.

are you using a multihead setup?
Comment 7 Fryderyk Dziarmagowski 2007-06-27 17:31:41 UTC
no, I got only one display configured.
Comment 8 Emmanuele Bassi (:ebassi) 2007-06-27 22:04:45 UTC
thanks. talking on irc, it seems that this is a bug hitting some gentoo users too, but it's not strictly triggered by the icon cache generation - which is why I cannot reproduce.

the icon cache of GtkRecentManager was added to avoid I/O performance problems; the GtkIconTheme in gtk+ trunk (2.11/2.12) is definitely better at this, so I think we can safely remove the local cache and rely on the icon theme object doing the right thing.
Comment 9 Mart Raudsepp 2007-06-29 13:15:59 UTC
We need a fix for GNOME-2.18 too, that means for gtk+-2.10.x.
Attaching a strace output from the freezes I'm experiencing in the end of gnome package upgrading process (around the time that it updates icon caches amongst other things)
Comment 10 Mart Raudsepp 2007-06-29 13:22:52 UTC
Created attachment 90865 [details]
end of a strace of gnome-panel before freeze - I have a bigger 1.1MB version too

This is a strace -ft `pidof gnome-panel` log while "re-emerging" gnome-applets. It froze around the time the reinstall progress got to update the icon caches and the strace output freezes too, waiting on a futex after another thread or fork segfaulted.
I haven't been able to reproduce it yet with just gtk-update-icon-cache --force /icon/path and it doesn't always freeze on gnome package installations, but annoyingly often.
Comment 11 Emmanuele Bassi (:ebassi) 2007-06-29 14:56:12 UTC
(In reply to comment #9)
> We need a fix for GNOME-2.18 too, that means for gtk+-2.10.x.

at this point, I'm dubious there will be another gtk+ 2.10 release, since 2.12 is supposed to be released within a month time, and this bug is neither reproducible with a fixed set of steps nor causes catastrophic loss of data.

I can attach the patch here and distributions still shipping 2.10 can backport it to their own packages. if mclasen wants to do a last 2.10 release, I can apply it to the gtk-2-10 branch too.
Comment 12 Emmanuele Bassi (:ebassi) 2007-06-29 14:57:09 UTC
Created attachment 90880 [details] [review]
Remove the icon cache from the GtkRecentManager

2007-06-29  Emmanuele Bassi  <ebassi@gnome.org>

       * gtk/gtkrecentmanager.c (get_icon_for_mime_type): Do not
       cache the icon pixbufs but rely on the GtkIconTheme not to
       hit the disk cache too much (should tentatively fix #426987).
Comment 13 Emmanuele Bassi (:ebassi) 2007-06-29 14:58:12 UTC
the patch above has been committed to trunk and should remove the cause of the segfaults by simply removing the icon cache and relying on the GtkIconTheme.
Comment 14 Matthias Clasen 2007-06-29 16:53:33 UTC
Yes, please do commit to 2.10, if you don't mind. I am definitively thinking about doing one more 2.10 release
Comment 15 Emmanuele Bassi (:ebassi) 2007-06-29 18:36:50 UTC
committed to gtk-2-10. people experiencing this bug with gtk+ 2.10 would please test it and check whether this has been truly fixed? thanks.
Comment 16 Fryderyk Dziarmagowski 2007-06-30 15:59:26 UTC
I can confirm, it solves the problem.
(gtk+ 2.10.13 with stable branch changes by Emmanuele).
Comment 17 Emmanuele Bassi (:ebassi) 2007-06-30 23:23:01 UTC
(In reply to comment #16)
> I can confirm, it solves the problem.
> (gtk+ 2.10.13 with stable branch changes by Emmanuele).

thanks for the test.