upstart user session leaks all the dbus events it receives

Bug #1302955 reported by Michael Blennerhassett
48
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Unity
Fix Released
Medium
Marco Trevisan (Treviño)
7.2
Fix Released
Medium
Marco Trevisan (Treviño)
unity (Ubuntu)
Fix Released
Medium
Marco Trevisan (Treviño)
Trusty
Fix Released
Medium
Stephen M. Webb
upstart (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

[Impact]

The unity-panel-service process has been caching D-Bus messages sent from upstart, effectively leaking memory. The solution replaces the offending code with a single upstart event emission.

[Test Case]

0. Make sure there is a user session job with a dbus rule (eg unity-greeter-session-broadcast)
1. Install and run system-load-indicator (indicator-multiload)
2. Set the update interval to 100ms
3. Now watch the memory use of init --user increase by 100kb per second
4. Also open up upstart-monitor to see all the dbus messages being sent

[Regression Potential]

Some kind of hidden functionality depending on upstart events sent through D-Bus to the unity-panel-service may have become disconnected. Unlikely.

[Other Info]

The fix for Ubuntu 14.04 LTS was cherry picked from the Ubuntu "Vivid Vervet" dev release where it has been in regular use for some time without apparent regression.

Related branches

Revision history for this message
Michael Blennerhassett (mjblenner) wrote :
description: updated
Revision history for this message
Michael Blennerhassett (mjblenner) wrote :

So, for some reason I had unity-greeter-session-broadcast installed. This has a user session dbus rule:

start on dbus BUS=system SIGNAL=StartUrl INTERFACE=com.canonical.Unity.Greeter.Broadcast OBJPATH=/com/canonical/Unity/Greeter/Broadcast

which is the only dbus rule for my user session. When I removed unity-greeter-session-broadcast, I can no longer see all the dbus messages in upstart-monitor, and init --user doesn't seem to leak any memory.

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upstart (Ubuntu):
status: New → Confirmed
Revision history for this message
James Troup (elmo) wrote :

I'm seeing the same thing:

 2676 james 20 0 2200268 871620 824 S 0.0 10.8 33:24.86 init --user

Revision history for this message
Michael Blennerhassett (mjblenner) wrote :

This also occurs if you pass --always to upstart-dbus-bridge, so I don't think it's got anything to do with upstart events/jobs.

I suspect this is a bug in unity-panel-service. Specifically at unity/services/panel-service.c:753. It's using dbus_connection_open() when it should be using g_dbus_connection_new_...() to get the mainloop integration. Without this, upstart hangs onto the dbus messages as they aren't being read. (LP: #1235649 )

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Intresting... I already was wondering if it was the case to get rid of nih_dbus from u-p-s and just using gdbus, so that seems to be the right thing to do.

tags: added: ups
Revision history for this message
Michael Blennerhassett (mjblenner) wrote :

Or, do what unity8 has done and get rid of the whole lot, and add

pre-start exec initctl --no-wait emit indicator-services-start

to the upstart unity-panel-service.conf

Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

Same thing here...seeing init take a mild 1.6G of my ram.
 5839 ben 20 0 1876920 1.669g 1564 S 0.7 7.1 9:15.98 init

What is interesting though is that out of the three systems where I have the multiload indicator installed, it is only happening on my main work rig.

Revision history for this message
ddalex (ddalex) wrote :

Happens to me too - 2.2 G taken.

  3830 0.3 18.7 2596616 2282860 ? Ss Apr29 11:02 \_ init --user

Just removed unity-greeter-session-broadcast, I'll report if it still happening.

Revision history for this message
Alexander Borodetsky (magum1977) wrote :

I have a same problem 2GB of RAM after 24 hours!

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity (Ubuntu):
status: New → Confirmed
Changed in unity:
importance: Undecided → Medium
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
milestone: none → 7.3.1
status: New → In Progress
Changed in unity (Ubuntu):
status: Confirmed → In Progress
importance: Undecided → Medium
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Andrea Azzarone (azzar1)
Changed in unity:
status: In Progress → Fix Committed
Changed in unity (Ubuntu):
status: In Progress → Fix Released
Stephen M. Webb (bregma)
Changed in unity:
status: Fix Committed → Fix Released
Stephen M. Webb (bregma)
Changed in unity (Ubuntu Trusty):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Stephen M. Webb (bregma)
Stephen M. Webb (bregma)
description: updated
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello Michael, or anyone else affected,

Accepted unity into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unity/7.2.4+14.04.20150316-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in unity (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.2.4+14.04.20150316-0ubuntu1

---------------
unity (7.2.4+14.04.20150316-0ubuntu1) trusty; urgency=medium

  [ Andrea Azzarone ]
  * Avoid running potentially dangerous code paths when the screen is
    locked. (LP: #1410582)
  * Ungrab the shoutdown dialog as soon as possible. (LP: #1398287)
  * Use COMPIZ_METAKEY where needed. (LP: #1363534)
  * disabled Pointer Barriers during lockscreen (LP: #1401911)
  * disabled markup for VolumeLauncherIcon quicklist menu items (LP:
    #1413411)
  * enable Dash, Hud, and session dialogs over full screen window (LP:
    #1159249, #860970, #1413773, #1404486)
  * made unity unlockable if user is in nopsswdlogin group (LP:
    #1413790)
  * skipped the animation of BGHash on startup to prevent unwanted fade-
    in (LP: #1241757)

  [ Luke Yelavich ]
  * extended accessible exploration of the Dash dynamic content (LP:
    #1066157)

  [ Marco Trevisan (Treviño) ]
  * MenuManager: make sure menus are always shown when mouse is over
    them or when the always-show-menus option is on (LP: #955193,
    #1390562, #1374942, #1312137)
  * PanelService: use gdbus to notfy upstart of service start/stop (LP:
    #1302955)
 -- CI Train Bot <email address hidden> Mon, 16 Mar 2015 17:30:35 +0000

Changed in unity (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for unity has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

tags: added: rls-w-incoming
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.