High CPU usage of wxWidget apps caused by dbusmenu

Bug #722375 reported by Jean-Baptiste Lallement
266
This bug affects 49 people
Affects Status Importance Assigned to Milestone
Guayadeque
Fix Released
High
Unassigned
Unity
Invalid
Undecided
Unassigned
Unity Foundations
Invalid
High
Conor Curran
appmenu-gtk (Ubuntu)
Invalid
High
Unassigned
Natty
Invalid
High
Unassigned
audacity (Ubuntu)
Fix Released
High
Unassigned
Natty
Fix Released
High
Unassigned
wxwidgets2.8 (Ubuntu)
Fix Released
High
Conor Curran
Natty
Fix Released
High
Conor Curran

Bug Description

Binary package hint: pgadmin3

When wxWidget application is launched (e.g pgadmin3) the desktop becomes really slow and X starts consuming a lot of CPU. The UI of pgadmin3 is like flickering very fast.

Everything returns to normal when pgadmin3 is closed.

There are minimal python and cpp examples attached to this report in minimal.tar.gz

This was introduced by the fix for bug 662077

TEST CASE:
1. Start a Unity session
2. Launch pgadmin3
3. Connect to a server
4. Launch the Query Tool

Result:
The desktop becomes very slow, X consuming most of the CPU and the UI of pgadmin3 is like flickering very fast.

WORKAROUND:
disable dbusmenu with:
$ UBUNTU_MENUPROXY= pgadmin3

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: pgadmin3 1.12.2-1
ProcVersionSignature: Ubuntu 2.6.38-4.31-generic 2.6.38-rc5
Uname: Linux 2.6.38-4-generic i686
Architecture: i386
Date: Mon Feb 21 00:14:53 2011
EcryptfsInUse: Yes
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.utf8
 LC_MESSAGES=en_US.utf8
 SHELL=/bin/bash
SourcePackage: pgadmin3

Related branches

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I'm unable to reproduce the problem this morning after an upgrade and restart of the system. I set the status to incomplete and will let it expire if it's not an issue anymore.

Changed in pgadmin3 (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

confirmed when the query tool is launched, X jumps to very CPU usage and the UI becomes unusable. Increasing priority to medium.

Changed in pgadmin3 (Ubuntu):
importance: Low → Medium
status: Incomplete → Confirmed
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

It's not reproducible with a Classic Desktop session with or without compiz running.
I'm adding a task for Unity since it is the only environment where this issue exists.

Changed in unity (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
description: updated
Changed in unity:
status: New → Confirmed
Revision history for this message
Franck (alci) wrote :

This is really a showstopper for anyone using postgresql databases on a regular basis as it makes pgadmin totally unusable with unity.

Changed in unity (Ubuntu Natty):
assignee: nobody → Canonical Desktop Experience Team (canonical-dx-team)
Revision history for this message
Ricardo Pedroso (rmdpedroso) wrote :

I think that this may be related to wxWidgets.
I saw this behaviour, for eg, with pyshell from wxPython.

And to be more specific, I think that the problem is with wxListCtrl
Not sure, but I guess that all wx apps that use ListCtrl will have this issue.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Ricardo, could you provide a simple test to reproduce this issue with wxWidgets ?

Revision history for this message
Ricardo Pedroso (rmdpedroso) wrote :

Attached.

I made 2 simple samples,
one in c++ (minimal.cpp) to be used with wxWidgets
the other with python (minimal.py) to be used with wxPython

Both have some directives to be change:
USE_MENUS 1 // 1 - with menus 0 - without menus
USE_LISTCTRL 1 // 1 - with a listctrl 0 - with a textctrl

The above combination, both 1's, is when we can reproduce the problem.
The tests were done with everything from the ubuntu repos.

Then I compiled wxWidgets from wxWidgets.org (wxGTK-2.8.11.tar.gz),
compiled the minimal.cpp attached against this build and I could not reproduce the problem.

My wxWidgets build was done simply with configure --enable-unicode

Revision history for this message
Ricardo Pedroso (rmdpedroso) wrote :

I found that the culprit is this patch:
http://launchpadlibrarian.net/64734089/wxwidgets2.8_2.8.11.0-0ubuntu6_2.8.11.0-0ubuntu7.diff.gz

Probably this bug should go to wxwidgets2.8 and/or appmenu-gtk

When run:
UBUNTU_MENUPROXY=0 ./minimal

There is no CPU usage problem with the problematics USE_MENUS 1 and USE_LISTCTRL 1

references:
https://bugs.launchpad.net/ubuntu/+source/wxwidgets2.8/+bug/662077
https://bugs.launchpad.net/ubuntu/+source/appmenu-gtk/+bug/660314
https://launchpad.net/ubuntu/+source/wxwidgets2.8/2.8.11.0-0ubuntu7

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for tracking this down and for the sample code.
I can reproduce the problem with your examples and confirm the disabling appmenu with UBUNTU_MENUPROXY=0 works around the problem.

I'm affecting to the right package.

affects: unity (Ubuntu Natty) → indicator-appmenu (Ubuntu Natty)
Changed in indicator-appmenu (Ubuntu Natty):
importance: Medium → High
milestone: none → ubuntu-11.04
status: Confirmed → Triaged
affects: pgadmin3 (Ubuntu Natty) → wxwidgets2.8 (Ubuntu Natty)
Changed in wxwidgets2.8 (Ubuntu Natty):
importance: Medium → High
milestone: none → ubuntu-11.04
status: Confirmed → Triaged
affects: indicator-appmenu (Ubuntu Natty) → appmenu-gtk (Ubuntu Natty)
summary: - CPU usage due to X becomes very high when pgadmin3 runs
+ High CPU usage of wxWidget apps caused by dbusmenu
description: updated
description: updated
Changed in unity:
status: Confirmed → Invalid
Changed in wxwidgets2.8 (Ubuntu Natty):
assignee: nobody → Canonical Desktop Experience Team (canonical-dx-team)
Conor Curran (cjcurran)
Changed in appmenu-gtk (Ubuntu Natty):
assignee: Canonical Desktop Experience Team (canonical-dx-team) → Conor Curran (cjcurran)
Changed in wxwidgets2.8 (Ubuntu Natty):
assignee: Canonical Desktop Experience Team (canonical-dx-team) → Conor Curran (cjcurran)
David Barth (dbarth)
Changed in unity-foundations:
milestone: none → unity-3.8.0-beta
assignee: nobody → Conor Curran (cjcurran)
importance: Undecided → High
status: New → Triaged
Conor Curran (cjcurran)
Changed in wxwidgets2.8 (Ubuntu Natty):
status: Triaged → In Progress
Changed in appmenu-gtk (Ubuntu Natty):
status: Triaged → In Progress
Changed in unity-foundations:
status: Triaged → In Progress
Benjamin Drung (bdrung)
Changed in audacity (Ubuntu Natty):
status: New → Confirmed
importance: Undecided → High
Luuk de Leest (luuk58)
Changed in unity:
status: Invalid → Confirmed
Revision history for this message
Ted Gould (ted) wrote :

I wanted to update this bug with some of the things that Conor found, and mentioned to me on IRC, just incase someone else had some ideas here. Some things that he's discovered:

 - This happens on Maverick as well
 - If you start the application without the menus alive (GNOME 2, remove the applet) and then start the menus the problem does not occur
 - If you start the app, remove the menus, then add them back, it doesn't appear after the menus are added back.

This leads us to believe that this is something in WxWidgets that is looking for the menubar and not finding as we've hidden it with appmenu. Still investigating, but hoping that someone who knows WxWidgets better might be able to help.

Revision history for this message
Ted Gould (ted) wrote :

Marking the Unity task as Invalid as Unity itself isn't causing this. It's the appmenu-gtk module.

Changed in unity:
status: Confirmed → Invalid
David Barth (dbarth)
Changed in unity-foundations:
milestone: unity-3.8.2 → unity-3.8.4
Revision history for this message
David Henningsson (diwic) wrote :

Hey folks, I came up with this patch which seems to resolve the issue here, and breaks the infinite loop caused by appmenu.patch.
Can you verify that it's not causing anything else, talk a little to upstream to see if they agree etc?

tags: added: patch
Revision history for this message
David Henningsson (diwic) wrote :

If you don't want to compile wxwidgets yourself to test, there is now a compiled version in ppa:diwic/ppa

Revision history for this message
Doug McMahon (mc3man) wrote :

Got duped here on audacity which is only wx app here
The patch does work well w/audacity using the appmenu, tested in unity login only

Revision history for this message
Abhishek Udupa (abhishek-udupa) wrote :

Confirm that fix works on guayadeque as well, which is a duplicate of this bug. Tested on Ubuntu Classic login, but with app-menu enabled via compiz-config. Thanks for the patch!

Revision history for this message
David Henningsson (diwic) wrote :

@bdrung, here's the debdiff you were asking for.

Revision history for this message
David Henningsson (diwic) wrote :

@bdrung, modified debdiff with dep-3 header according to your wishes

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wxwidgets2.8 - 2.8.11.0-0ubuntu8

---------------
wxwidgets2.8 (2.8.11.0-0ubuntu8) natty; urgency=low

  * debian/patches/appmenu2.patch: Fix high CPU usage with
    appmenu-gtk, which was caused by appmenu.path (LP: #722375)
 -- David Henningsson <email address hidden> Wed, 06 Apr 2011 15:30:16 +0200

Changed in wxwidgets2.8 (Ubuntu Natty):
status: In Progress → Fix Released
Benjamin Drung (bdrung)
Changed in audacity (Ubuntu Natty):
status: Confirmed → Fix Released
Changed in appmenu-gtk (Ubuntu Natty):
status: In Progress → Invalid
assignee: Conor Curran (cjcurran) → nobody
Revision history for this message
David Henningsson (diwic) wrote :

When trying to upstream this bug, I was made aware that a very similar fix was already upstream: http://svn.wxwidgets.org/viewvc/wx/wxWidgets/branches/WX_2_8_BRANCH/src/gtk/frame.cpp?r1=66344&r2=67149

Conor Curran (cjcurran)
Changed in unity-foundations:
status: In Progress → Invalid
anonbeat (anonbeat)
Changed in guayadeque.player:
status: New → Fix Released
importance: Undecided → High
tags: added: testcase
Revision history for this message
harpreet bhatia (bluepicaso) wrote :

still probelm in 12.04, with filezilla

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.