unity-panel-service memory leak when starting various applications

Bug #835646 reported by Hernando Torque
84
This bug affects 16 people
Affects Status Importance Assigned to Milestone
Application Menu Indicator
Fix Released
Undecided
Ted Gould
DBus Menu
Fix Released
Undecided
Michael Terry
Unity
Invalid
High
Ted Gould
Unity Distro Priority
Fix Released
Undecided
Unassigned
indicator-appmenu (Ubuntu)
Fix Released
High
Unassigned
unity (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Opening various programs causes unity-panel-service to use more and more resident memory (that won't be freed after program termination).

Attaching a valgrind log of unity-panel-service containing ten starts of Kile (which caused unity-panel-service to go from 23 MB to 119 MB resident memory usage):

==8130== LEAK SUMMARY:
==8130== definitely lost: 45,015 bytes in 508 blocks
==8130== indirectly lost: 203,173 bytes in 5,553 blocks
==8130== possibly lost: 23,453 bytes in 450 blocks
==8130== still reachable: 28,961,416 bytes in 525,544 blocks

TEST CASE:
1. Open a gnome-terminal window.
2. Run 'while true; do ps aux | grep unity-panel-service | grep -v grep; sleep 1; done' and monitor the sixth column (resident memory usage in KB).
3a. Open and close Gimp, or if zou don't have that installed:
3b. Open and close Nautilus.

RESULTS:
For 3a: memory increases by ~12 MB.
For 3b: memory increases by ~2 MB.

I'm currently running Unity from trunk (r1455) but this also happens with Unity from Oneiric and a daily live CD (amd64 - 20110827). This also affectes unity-2d

Related branches

Revision history for this message
Hernando Torque (htorque) wrote :
Revision history for this message
Hernando Torque (htorque) wrote :

This seems to affect various applications ranging from 1-2MB (nautilus, gedit, banshee) to 7-12MB for inkscape, gimp. It doesn't matter if I start those applications throught the launcher or via command line.

Although I'm seeing this on two different systems, I'll try a live CD to make sure it's not some issue with my installations.

Revision history for this message
Hernando Torque (htorque) wrote :

Same thing happens with today's live CD (amd64 - 20110827).

summary: - unity-panel-service memory leak with Kile
+ unity-panel-service memory leak when starting various applications
description: updated
Changed in unity:
status: New → Confirmed
Changed in unity (Ubuntu):
status: New → Confirmed
Omer Akram (om26er)
Changed in unity:
importance: Undecided → High
Changed in unity (Ubuntu):
importance: Undecided → High
description: updated
tags: added: oneiric unity unity-2d
Revision history for this message
Neil J. Patel (njpatel) wrote :

Hey Hernando, could you try testing `/usr/lib/libindicator/indicator-loader /usr/lib/indicators3/6/libappmenu.so` and see if that is leaking for you (probably from metacity, without an exsiting global menu)? I'd like to try and isolate it to one of the indciators or the service itself (which shows leaking if one of the indicators leaks).

Thanks!

Changed in unity:
assignee: nobody → Neil J. Patel (njpatel)
milestone: none → 4.14.0
Revision history for this message
Hernando Torque (htorque) wrote :

Just a correction of #4: you need indicator-loader3 from the libindicator3-tools package.

Adding valgrind log of opening GIMP and Kile a couple of times.

Revision history for this message
Neil J. Patel (njpatel) wrote :

Using this to track the issue as it's pretty high priority, but the problem is in indicator-appmenu, so assigning it to Ted.

Changed in indicator-appmenu:
assignee: nobody → Ted Gould (ted)
Changed in unity:
assignee: Neil J. Patel (njpatel) → Ted Gould (ted)
Changed in unity:
milestone: 4.14.0 → 4.16.0
Revision history for this message
Ted Gould (ted) wrote :

So, I've spend the better part of today looking through this and I can't really find anything. One small leak, but I'm pretty sure that it isn't big enough to be an issue here. I'm attaching a "turn it up to 11" valgrind log where I went through all the stacks that included dbusmenu or appmenu and couldn't find anything noticible in the code. I'm not quite sure where to go from here on this bug.

Changed in unity:
milestone: 4.16.0 → 4.18.0
Revision history for this message
Michael Terry (mterry) wrote :

FYI, I'm taking a look at this too. If I comment out the gtkclient bits of window_menus_new in indicator-appmenu, (perhaps unsurprisingly) I don't get the leak anymore. I'm looking into dbusmenu now for why that might be.

Changed in unity:
milestone: 4.18.0 → 4.20.0
affects: unity (Ubuntu) → libappindicator (Ubuntu)
affects: libappindicator (Ubuntu) → indicator-appmenu (Ubuntu)
Changed in unity:
milestone: 4.20.0 → 4.22.0
Changed in unity (Ubuntu):
status: New → Confirmed
Changed in unity:
milestone: 4.22.0 → 4.24.0
Revision history for this message
Michael Terry (mterry) wrote :

I've been doing some work on this. With the following merges on top of current oneiric, I think we're mostly good:

https://code.launchpad.net/~mterry/dbusmenu/unref-gtkmenuitems/+merge/78156
https://code.launchpad.net/~mterry/dbusmenu/fix-bad-image-set/+merge/78303
https://code.launchpad.net/~mterry/indicator-appmenu/double-ref-of-entry-label/+merge/78300

Probably better as a couple SRUs at this late juncture?

Revision history for this message
Hernando Torque (htorque) wrote :

It still raises pretty fast from 20 to 50 MB but then it seems to slow down and applications don't add the same amount of memory on every start (or none at all, like restarting GIMP at that time doesn't add anything).

At least the times of u-p-s using 500+ MB seem to be over, good job! :-)

Revision history for this message
Michael Terry (mterry) wrote :

Hernando, you were testing with my branches?

Revision history for this message
Hernando Torque (htorque) wrote :

Yeah, I was testing you branches. I simply patched the Ubuntu sources and rebuilt the packages (didn't want to screw things up, as I wasn't sure if '--prefix=/usr' was all that's needed for building).

It's definitely an improvement, but I'd still like to see the memory usage actually go down when I close a program (u-p-s is currently using ~60 MB and would stay the same if I'd close all running programs).

Revision history for this message
Michael Terry (mterry) wrote :

I couldn't find any more obvious problems with my methods (using gobject-list [1], valgrind, and printfs). I'm going to stop looking at this for now.

[1] http://blogs.gnome.org/danni/2011/02/17/ld_preload-gobject-lifetime-debugging-tool/

Ted Gould (ted)
Changed in dbusmenu:
status: New → Fix Committed
assignee: nobody → Michael Terry (mterry)
milestone: none → 0.5.1
Ted Gould (ted)
Changed in dbusmenu:
status: Fix Committed → Fix Released
Revision history for this message
Ken VanDine (ken-vandine) wrote :

This was fixed in 0.3.1-0ubuntu2

Changed in indicator-appmenu (Ubuntu):
status: Confirmed → Fix Released
Changed in unity:
milestone: 4.24.0 → 4.26.0
Changed in unity:
status: Confirmed → Invalid
Changed in unity (Ubuntu):
status: Confirmed → Invalid
Changed in unity-distro-priority:
status: New → Fix Committed
Tim Penhey (thumper)
tags: added: udp
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Also the accessible description of indicator sound leaks some memory when changing the volume level. This branch fixes the issue: https://code.launchpad.net/~3v1n0/indicator-sound/add-name-hint_fix-memleak

Changed in unity-distro-priority:
status: Fix Committed → Fix Released
Ted Gould (ted)
Changed in indicator-appmenu:
status: New → Fix Released
Revision history for this message
Colin Harrington (colin-harrington) wrote :

Wow, I'm running 12.04 and saw the unity-panel-service hit 517.9 MiB Does this warrant a new bug?

Revision history for this message
Jan Vlnas (jnv) wrote :

This particular issue was fixed. If unity-panel-service is still leaking for you, see bug #987060.

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.