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 122327 - Notification area takes 100% cpu
Notification area takes 100% cpu
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.2.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Panel Maintainers
: 122263 123762 127056 127802 128322 130554 134521 136819 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-09-15 09:24 UTC by Frederic Crozat
Modified: 2011-02-04 16:12 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4


Attachments
trace from pam-panel-icon (727 bytes, text/plain)
2003-09-15 13:01 UTC, Frederic Crozat
  Details
trace of notification-area (376.22 KB, text/plain)
2003-09-15 13:03 UTC, Frederic Crozat
  Details
gnome-panel trace (14.19 KB, text/plain)
2003-09-15 13:03 UTC, Frederic Crozat
  Details
pam-panel-icon trace with verbose patched gtk (3.12 KB, text/plain)
2003-09-15 15:27 UTC, Frederic Crozat
  Details
notification area trace with verbose patched gtk (1.37 KB, text/plain)
2003-09-15 15:28 UTC, Frederic Crozat
  Details
gnome-panel trace with verbose patched gtk+ (3.20 KB, text/plain)
2003-09-15 15:28 UTC, Frederic Crozat
  Details
notification area log with plugsocket + verbose gtk (318.53 KB, text/plain)
2003-09-15 16:17 UTC, Frederic Crozat
  Details
It works, it works! Formal patch. (440 bytes, patch)
2003-10-07 01:06 UTC, Pat Suwalski
none Details | Review

Description Frederic Crozat 2003-09-15 09:24:40 UTC
Everything is GNOME 2.4.0.

Try the following :
-first start an application which displays a tray icon (pam-panel-icon or
rhythmbox)
-then, start gnome-panel, with a notification area

watch your CPU :
25% for notification-area
25% for X
25% for application providing the tray icon
25% for gnome-panel

Strangely, I don't get this when I downgrade from GTK+ 2.2.4 to 2.2.1 ...
Comment 1 Frederic Crozat 2003-09-15 09:55:23 UTC
More info on this bug :

With GTK+ 2.2.4, if I give focus to notification-area manually (with
mouse), the 100% cpu bug disappears.

I might be caused by this GTK commit :
Wed Aug 20 21:26:49 2003  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkplug.c (gtk_plug_focus): Send the focus on
        to the parent when there was no focus widget before
        and no focus widget after - that is, when there are
        no focusable widgets. (#108678, help tracking it
        down from Padraig O'Briain, Federico Mena Quintero, )

adding owen for review
Comment 2 Owen Taylor 2003-09-15 10:36:32 UTC
Well, I wouldn't be suprised if that change causes the problem -
it was a fairly massive rewriting of focus-related code
for GtkPlug/GtkSocket, fixing important problems. 

But without information about the details of what's going
on on your system, I can't do anything to fix.

If you still don't have a functioning gdb, what you can do is
compile GTK+ with --enable-debug and then set 
GTK_DEBUG=plugsocket ... that should give you some useful
debug output.
Comment 3 Frederic Crozat 2003-09-15 13:01:37 UTC
Created attachment 19945 [details]
trace from pam-panel-icon
Comment 4 Frederic Crozat 2003-09-15 13:03:04 UTC
Created attachment 19946 [details]
trace of notification-area
Comment 5 Frederic Crozat 2003-09-15 13:03:43 UTC
Created attachment 19947 [details]
gnome-panel trace
Comment 6 Frederic Crozat 2003-09-15 13:12:14 UTC
I had to truncate log files because they all contains big chunks of
similar output : the focus finder code is probably in a infinite loop..
Comment 7 Owen Taylor 2003-09-15 14:59:12 UTC
OK, the problem seems to be in the notification area ... somehow,
it's not sending the FOCUS_NEXT message on to the panel toplevel ...

In gtksocket.c:advance_toplevel_focus(), could you add the 
debug spew:

  if (!GTK_WIDGET_TOPLEVEL (toplevel) || GTK_IS_PLUG (toplevel))
    {
+     g_print ("Sending focus_next message on to plug toplevel\n");
      gtk_widget_child_focus (toplevel,direction);
      return;
    }

And in gtkplug.c:gtk_plug_focus() add

  /* We override GtkWindow's behavior, since we don't want wrapping here.
   */
+
+ g_print ("gtk_plug_focus: old_focus_child=%p\n", old_focus_child);
+
  if (old_focus_child)
    {
      if (gtk_widget_child_focus (old_focus_child, direction))
        return TRUE;
 
And in gtksocket.c:gtk_socket_claim_focus() add:

static void
gtk_socket_claim_focus (GtkSocket *socket,
                        gboolean   send_event)
{
+ g_Print ("gtk_socket_claim_focus(), send_event=%d\n", send_event); 
+
  if (!send_event)
    socket->focus_in = TRUE;    /* Otherwise, our notify handler will
send FOCUS_IN  */
Comment 8 Frederic Crozat 2003-09-15 15:27:25 UTC
Created attachment 19950 [details]
pam-panel-icon trace with  verbose patched gtk
Comment 9 Frederic Crozat 2003-09-15 15:28:05 UTC
Created attachment 19951 [details]
notification area trace with verbose patched gtk
Comment 10 Frederic Crozat 2003-09-15 15:28:57 UTC
Created attachment 19952 [details]
gnome-panel trace with verbose patched gtk+
Comment 11 Frederic Crozat 2003-09-15 15:31:04 UTC
Sorry for the spam, I can't attach 3 files at the same time..

Again, I've put only partial traces since they are very big and are
only repeating themselves..
Comment 12 Owen Taylor 2003-09-15 15:37:13 UTC
A) I only need the debug spew from the notification area - the
   other two are behaving correctly
B) It would be useful to have the GTK_DEBUG=plugsocket spew
   turned on as well for this

But actually I have an idea here.

Could you try the following patch to gtksocket.c:gtk_socket_focus()

-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_is_focus (widget))

Thanks.
Comment 13 Frederic Crozat 2003-09-15 16:17:24 UTC
Created attachment 19953 [details]
notification area log with plugsocket + verbose gtk
Comment 14 Frederic Crozat 2003-09-15 16:18:20 UTC
I've attached log of notification area WITHOUT your patch..

I've tested your patch and it FIXED the problem !!

Is it a workaround for notification-area or a real fix for GTK ?
Comment 15 Owen Taylor 2003-09-15 16:27:45 UTC
It's the real fix. The docs for gtk_widget_is_focus() should
make clear why it is necessary.

 Determines if the widget is the focus widget within its
 toplevel. (This does not mean that the %HAS_FOCUS flag is
 necessarily set; %HAS_FOCUS will only be set if the
 toplevel widget additionally has the global input focus.)
Comment 16 Frederic Crozat 2003-10-03 09:26:01 UTC
*** Bug 122263 has been marked as a duplicate of this bug. ***
Comment 17 Olav Vitters 2003-10-03 19:01:40 UTC
*** Bug 123762 has been marked as a duplicate of this bug. ***
Comment 18 Pat Suwalski 2003-10-07 00:30:20 UTC
So, can this bug be marked Resolved->fixed? I ask, because I have the
same issue and it would be nice to see it go away. Magically, if
possible. :)
Comment 19 Pat Suwalski 2003-10-07 01:06:18 UTC
Created attachment 20520 [details] [review]
It works, it works! Formal patch.
Comment 20 Owen Taylor 2003-10-07 16:25:32 UTC
It won't be marked RESOLVED/FIXED until the code has committed
to CVS. That will be prior to the next stable release of GTK+.
Comment 21 Ali Akcaagac 2003-10-14 21:12:18 UTC
I confirm this problem, as done on gnomesupport.org forum already.
This problem also persists in GTK+ HEAD and should be solved there as
well. At least acme behaves the same way with GTK+ HEAD.
Comment 22 Bryan W Clark 2003-11-11 01:13:34 UTC
Sorry for the spam everyone.

This might be a dumb question, but is there a reason that this fix
hasn't been commited to CVS yet?
Comment 23 Vincent Untz 2003-11-20 13:51:45 UTC
*** Bug 127056 has been marked as a duplicate of this bug. ***
Comment 24 Soren Sandmann Pedersen 2003-11-20 15:02:53 UTC
Committed to both stable and head.

Thu Nov 20 15:48:03 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtksocket.c (gtk_socket_focus): Use gtk_widget_is_focus()
	instead of GTK_WIDGET_HAS_FOCUS. (#122327, Owen Taylor. Reported
	by Frederic Crozat).

Comment 25 Bastien Nocera 2003-11-24 14:38:03 UTC
*** Bug 127802 has been marked as a duplicate of this bug. ***
Comment 26 Vincent Untz 2003-12-02 10:56:12 UTC
*** Bug 128322 has been marked as a duplicate of this bug. ***
Comment 27 Matthew Gatto 2004-01-05 23:18:37 UTC
*** Bug 130554 has been marked as a duplicate of this bug. ***
Comment 28 Fred Blaise 2004-01-06 02:53:51 UTC
I just downloaded the source (gtk+-2.2.4)... looked at the source, and
the code was still the old line... :X changed it... configure, make &&
make install...
Restarted X.. I am still getting the 100% CPU utilization...

Is there something I am missing?

Thanks.
Comment 29 George Karabin 2004-01-14 17:00:41 UTC
Yeah - it looks like it's targeted for 2.2.5. 2.2.4 was released 11
days before this bug was filed, much less fixed. The patch is in CVS
now
(http://cvs.gnome.org/bonsai/cvsview2.cgi?diff_mode=context&whitespace_mode=show&file=gtksocket.c&branch=&root=/cvs/gnome&subdir=gtk%2b/gtk&command=DIFF_FRAMESET&rev1=1.58&rev2=1.59)
Comment 30 Bastien Nocera 2004-02-18 10:26:12 UTC
*** Bug 134521 has been marked as a duplicate of this bug. ***
Comment 31 Mikael Hallendal 2004-03-12 14:43:30 UTC
*** Bug 136819 has been marked as a duplicate of this bug. ***