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 660423 - CPU at 100%, sched_yield
CPU at 100%, sched_yield
Status: RESOLVED DUPLICATE of bug 651650
Product: glib
Classification: Platform
Component: gdbus
2.28.x
Other Linux
: Normal critical
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-09-29 07:48 UTC by Thomas M.
Modified: 2011-11-15 12:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Thomas M. 2011-09-29 07:48:17 UTC
Sometimes I see gnome-volume-manager using 100% of one CPU.

Doing a strace shows the following trace:

09:26:52.957842 sched_yield()           = 0
09:26:52.958008 sched_yield()           = 0
09:26:52.958085 sched_yield()           = 0
09:26:52.958149 sched_yield()           = 0
09:26:52.958207 sched_yield()           = 0
09:26:52.958262 sched_yield()           = 0
09:26:52.958315 sched_yield()           = 0
09:26:52.958369 sched_yield()           = 0
09:26:52.958423 sched_yield()           = 0
09:26:52.958475 sched_yield()           = 0
09:26:52.958528 sched_yield()           = 0
09:26:52.958581 sched_yield()           = 0
09:26:52.958634 sched_yield()           = 0
09:26:52.958686 sched_yield()           = 0
09:26:52.958740 sched_yield()           = 0
09:26:52.958793 sched_yield()           = 0
09:26:52.958846 sched_yield()           = 0

A gdb backtrace looks as follows:

(gdb) bt
  • #0 __kernel_vsyscall
  • #1 sched_yield
    at ../sysdeps/unix/syscall-template.S line 82
  • #2 g_thread_yield_posix_impl
    at /build/buildd-glib2.0_2.28.6-1-i386-A3fp41/glib2.0-2.28.6/./gthread/gthread-posix.c line 378
  • #3 _g_dbus_shared_thread_ref
    at /build/buildd-glib2.0_2.28.6-1-i386-A3fp41/glib2.0-2.28.6/./gio/gdbusprivate.c line 354
  • #4 _g_dbus_worker_new
    at /build/buildd-glib2.0_2.28.6-1-i386-A3fp41/glib2.0-2.28.6/./gio/gdbusprivate.c line 1449
  • #5 initable_init
    at /build/buildd-glib2.0_2.28.6-1-i386-A3fp41/glib2.0-2.28.6/./gio/gdbusconnection.c line 2380
  • #6 g_initable_init
    at /build/buildd-glib2.0_2.28.6-1-i386-A3fp41/glib2.0-2.28.6/./gio/ginitable.c line 106
  • #7 g_bus_get_sync
    at /build/buildd-glib2.0_2.28.6-1-i386-A3fp41/glib2.0-2.28.6/./gio/gdbusconnection.c line 6303
  • #8 ??
    from /usr/lib/libgconf-2.so.4
  • #9 gconf_activate_server
    from /usr/lib/libgconf-2.so.4
  • #10 ??
    from /usr/lib/libgconf-2.so.4
  • #11 ??
    from /usr/lib/libgconf-2.so.4
  • #12 ??
    from /usr/lib/libgconf-2.so.4
  • #13 gconf_engine_all_entries
    from /usr/lib/libgconf-2.so.4
  • #14 ??
    from /usr/lib/libgconf-2.so.4
  • #15 gconf_client_add_dir
    from /usr/lib/libgconf-2.so.4
  • #16 ??
  • #17 __libc_start_main
    at libc-start.c line 228
  • #18 ??


Although I've not been able to reproduce consistenly, I've been hit a fair by this bug afair amount of time in the past weeks.

The only work around I've found is to kill the process. It seems that gnome-volume-manager is not required to run Gnome 3, so I will remove it from my system, but there still might be a bug inside glib that needs to be fixed (gthread or gio?) ?

I'm running glib 2.28.6 (Debian 2.28.6-3).
Comment 1 Thomas M. 2011-09-29 07:49:52 UTC
Might be a duplicate of #627724 (same backtrace).
Comment 2 Matthias Clasen 2011-09-30 12:06:21 UTC
fwiw, the yield call is no longer present in glib 2.30
Comment 3 Colin Walters 2011-09-30 12:58:13 UTC
We need the output of "t a a bt", not just "bt", because the former gives us all threads.  See https://live.gnome.org/GettingTraces
Comment 4 Thomas M. 2011-09-30 13:49:48 UTC
Colin: I initially had only done a 'bt', I then did a "thread all apply bt" which, unless I wasn't properly awake, did not show more than one thread.
Comment 5 Simon McVittie 2011-11-14 11:54:54 UTC
I believe this only affects 2.28; now that GNOME 3.0 has reached Debian testing, GNOME 3.2 (including GLib 2.30) should hopefully follow soon, which should solve this.

Mathias Hasselmann recently noticed that GDBus 2.28's implementation of waiting for the worker thread to start isn't safe, because the worker thread (which sets data->done) doesn't use a memory barrier to ensure that the write becomes visible to the user thread (which reads it in the snippet he quotes here):

11:13 < hasselmm> 11:10:35> hmm....
11:13 < hasselmm> 11:10:39> "  /* wait for the user code to run.. hmm.. 
                  probably use a condition variable instead */
11:13 < hasselmm> 11:10:40>   while (!data->done)
11:13 < hasselmm> 11:10:40>     g_thread_yield ();
11:13 < hasselmm> 11:10:40> "
11:13 < hasselmm> 11:11:27> hah, mutable is not volatile
...
11:16 <@smcv> hasselmm: data->done should be atomic access at least, yeah

In the GLib packages for Maemo (theoretically based on GLib 2.28, but with increasing amounts of 2.30), I've done a backport of Colin's commit 7ed328a from 2.30, which should fix this.
Comment 6 Simon McVittie 2011-11-14 12:03:51 UTC
If this is indeed solved by Colin's commit 7ed328a, then it's a dup of Bug #651650.
Comment 7 Matthias Clasen 2011-11-15 12:00:18 UTC

*** This bug has been marked as a duplicate of bug 651650 ***