X server memory leaks related to dbus

Bug #186354 reported by Lukas Hejtmanek
58
This bug affects 8 people
Affects Status Importance Assigned to Milestone
X.Org X server
Invalid
Medium
xorg-server (Ubuntu)
Fix Released
Medium
Unassigned
Nominated for Lucid by Adam Porter
Nominated for Maverick by Adam Porter

Bug Description

[Original Report]
After running for 5 days, the X server eats 500MB RAM (RSS), xrestop reports 80MB of pixmaps. No OpenGL application is running. I use Intel driver (965GM). Right after starting the X server, it consumes only about 40MB RAM.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

what about firefox?

Changed in xorg-server:
status: New → Incomplete
Revision history for this message
Lukas Hejtmanek (xhejtman) wrote :

I believe, the leak is firefox induced but the consumed memory does not get free if I kill firefox (and firefox is not definitely running.).

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

What version of xserver-xorg-core do you have? Do you use compiz?

Revision history for this message
Lukas Hejtmanek (xhejtman) wrote :

xserver-xorg-core 2:1.4.1~git20080118-1ubuntu

I do not use compiz or any other 3D desktop. I use gnome and openbox.

Revision history for this message
In , Brice Goglin (brice-goglin) wrote :

Ian Beckwith reported the following on the Debian BTS today. He's using Xserver from the 1.4.1 branch (snapshot from January 31th). His report contains interesting things about dbus being involved in some memory leaks. Let's hope it will help. He says:

After running for 52 days (and adding lots of swap), it was taking up 1831m of virtual memory:

  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
14893 root 5 -10 1831m 16m 1840 S 0.7 3.6 1690:08 Xorg

I suspect it is something to do with DBus, as running strings(1) on swap produced lots of references to dbus:

$ sudo strings /dev/hda2 /home/sys/swap/* |fgrep org.freedesktop.DBus.Local|wc -l
446272

The strings output contained lots of copies of:

unix:path=/var/run/dbus/system_bus_socket
org_freedesktop_general
org_freedesktop_general
org_freedesktop_general
/org/freedesktop/DBus/Local
org.freedesktop.DBus.Local
Disconnected
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
ECTED EXTERNAL DBUS_COOKIE_SHA1 ANONYMOUS

DBus appears to be working OK (at least running dbus-monitor then starting pidgin produced a flurry of messages).

In case it is relevant, I'm running ion3 with mostly xterms.

The data above was with a recent but non-current version of X from unstable, I've now been running for 19 days with the version that was in unstable 19 days ago, and X is up to 734Mb of VM usage.

Revision history for this message
megahead13 (sigastiras13) wrote : Re: X server has huge memory leaks

I can confirm the memory leak of Xorg. I have the same behavior that it is described here: http://suseforums.net/index.php?showtopic=35760

"I was monitoring the processes with conky, top, and free. I was working without beryl, emerald and kiba-dock and the situation is the same, after a few minutes the use of RAM increase slowly, but something strange happens, conky shows 340 of 940 MB of RAM used, while free -m shows 820 of 940 MB used. The common process in gnome are running, no beryl, kiba-dock or emerald are running, only firefox, wine and Xorg. I'm thinking that X org 7.2 have some weird."

Lot of other users are mentioning the problem many months now:

http://ubuntuforums.org/showthread.php?t=601174
http://ubuntuforums.org/showthread.php?t=440038&page=5
http://ubuntuforums.org/showpost.php?p=3663062&postcount=222

It's not distro specific: http://forums.gentoo.org/viewtopic-t-537634-postdays-0-postorder-asc-highlight-xorg+memory+leak-start-100.html

There is also a bugreport opened in freedesktop.org bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=14639

Personally, I noticed the problem since I 've upgraded my Kubuntu Gutsy to the patched KDE 3.5.8 (for the xembed issue of flash) and then to KDE 3.5.9 I 've even upgraded to Hardy's 2.6.24 kernel, but no use. I 've tried also by closing most of the common applications/services I use daily (like amarok, kopete, superkaramba, kmail, etc.), but nothing changed. The problem is the same either when using firefox or konqueror. With konqueror things are worse (maybe due to this bug: https://bugs.launchpad.net/ubuntu/+source/kdebase/+bug/189525 ). But from what I understand that has nothing to do with DEs, WMs and drivers...

Look at these:

cat /proc/7658/status
Name: Xorg
State: S (sleeping)
SleepAVG: 98%
Tgid: 7658
Pid: 7658
PPid: 7647
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 128
Groups:
VmPeak: 505876 kB
VmSize: 461808 kB
VmLck: 168 kB
VmHWM: 403236 kB
VmRSS: 398104 kB
VmData: 390448 kB
VmStk: 84 kB
VmExe: 1824 kB
VmLib: 14536 kB
VmPTE: 1076 kB
Threads: 1
SigQ: 0/16372
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001000
SigCgt: 0000000051806ecb
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff
Cpus_allowed: 03
Mems_allowed: 00000000,00000001

ps aux | grep /usr/bin/X
root 7658 16.8 19.3 461808 398104 tty7 SLs+ Mar10 150:03 /usr/bin/X -br -nolisten tcp :0 vt7 -auth /var/run/xauth/A:0-6h6to4

uptime
14:10:11 up 04:53, 1 user, load average: 2.90, 2.29, 1.32

free
             total used free shared buffers cached
Mem: 2062176 2046412 15764 0 6060 902232
-/+ buffers/cache: 1138120 924056
Swap: 3148700 1066884 2081816

And that is nothing... I think now you have enough info to change the status of this bug to "confirmed".

Revision history for this message
In , sergiomb (sergio-sergiomb) wrote :

I had some strange HAL / DBUS / EVDEV things after some hibernations and resumes of my laptop.

Revision history for this message
Dmitry Agafonov (dmitry-agafonov) wrote : Re: X server has huge memory leaks

I have integrated intel video 82915G/GV/910GL.
After rebooting with intel driver Xorg uses >340Mb of RAM.
If I use vesa driver Xorg RAM usage is less than 50Mb.
Seems driver is not memory optimized or leaking.
X Window System Version 1.3.0, Gutsy.

Revision history for this message
In , Daniel Stone (daniels) wrote :

*** Bug 13538 has been marked as a duplicate of this bug. ***

Revision history for this message
In , sergiomb (sergio-sergiomb) wrote :

Created an attachment (id=16607)
Xorg.0.log crash

Hi, seems to me this could be relevant.

I had install the same packages of X server 1.4.1 of my laptop, on laptop of my co-worker which is next to me. And one day after some network problems my laptop and his laptop had a X crash.
I notice that I just had X crash one time a month and in the office.

Last Wednesday I had a X crash.

May 14 18:49:11 segulix NetworkManager: <info> Deactivating device eth0.
May 14 18:49:11 segulix NetworkManager: <info> eth0: canceled DHCP transaction, dhclient pid 30167
May 14 18:49:14 segulix kdm[2130]: X server for display :0 terminated unexpectedly

Seems that network problems and Networkmanager can make a X crash !

Revision history for this message
In , sergiomb (sergio-sergiomb) wrote :

let's test it:

Fix hal shutdown crash.

Removing the device invalidates its ->next pointer. Copy it aside before

destroying the device.

(cherry picked from commit f52f6c5c7efc281f9ac204fbaa4f71383df7463d)

http://gitweb.freedesktop.org/?p=xorg/xserver.git;a=commit;h=d5a7badd6a0ea4ecbe76f0205aa53b42f7cd90dc

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

*** Bug 16574 has been marked as a duplicate of this bug. ***

Revision history for this message
Mehul J. Rajput (mehulrajput) wrote : Re: X server has huge memory leaks

I am using hardy heron and I too have the same problem. I use compiz and same 945GM intel laptop. I can provide more information on the same if required.

Revision history for this message
Alexandru Armean (alex-armean) wrote :

i also have this memory leak in Xorg.

here are my specs :

X.Org X Server 1.4.0.90
Release Date: 5 September 2007
X Protocol Version 11, Revision 0
Build Operating System: Linux Ubuntu (xorg-server 2:1.4.1~git20080131-1ubuntu9.2)
Current Operating System: Linux venus 2.6.24-19-generic #1 SMP Wed Aug 20 17:53:40 UTC 2008 x86_64
Build Date: 13 June 2008 01:10:57AM

Ubuntu 8.04.1 all the updates installed.

i have seen a positive correlation between opening (/using) firefox and the increase in memory usage by the Xorg process. In Firefox i have the npwrapper flash plugin. i have the latest nvidia drivers installed and use xinerama over 3 monitors ( trough 2 graphic cards ).

Changed in xorg-server:
status: Unknown → Confirmed
Revision history for this message
Alexandru Armean (alex-armean) wrote :

i found out that by disabling xinerama i dont have the leak anymore.

Revision history for this message
Ittay Dror (ittay-dror) wrote :

same issues for me.

Revision history for this message
Ittay Dror (ittay-dror) wrote :

will using MOZ_DISABLE_IMAGE_OPTIMIZE=1 help (https://wiki.mozilla.org/Mobile/MemoryReduction)?

Bryce Harrington (bryce)
Changed in xorg-server:
importance: Undecided → Medium
status: Incomplete → Triaged
description: updated
Revision history for this message
wei (futurewayne) wrote :

I don't know whether the following info help.
I restarted my system when I left my office and didn't run any big program, like Firefox. Then use "free -m" to exam the memory usage.

wayne@Wayne-laptop:~$ free -m
             total used free shared buffers cached
Mem: 2999 518 2480 0 15 302
-/+ buffers/cache: 201 2798
Swap: 486 0 486

I disabled sleep and hibernate, and in the next morning I ran "free -m" again.
wayne@Wayne-laptop:~$ free -m
             total used free shared buffers cached
Mem: 2999 830 2169 0 116 458
-/+ buffers/cache: 255 2744
Swap: 486 0 486

X.org including some daemons consumed more 300MB over one night.
Is it reasonable?

Revision history for this message
wei (futurewayne) wrote :

wayne@Wayne-laptop:~/tmp/azure_dev/src$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
wayne@Wayne-laptop:~/tmp/azure_dev/src$ uname -a
Linux Wayne-laptop 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux

Revision history for this message
Alan Chandler (alan-chandlerfamily) wrote :

I am running the patched version of the intel driver 2:2.7.0-1ubuntu2~xup~1 to help with the freeze, and I also have a severe memory leak.

Overnight (approx 12 hours) my swap space grew from nothing to 2G.

When I tried to logout kdm apparently hung. I could ssh in from another machine and re-start kdm, and swap cleared to nothing.

Revision history for this message
zippidy_josh (redstone) wrote :

I also have noticed the X binary growing to 1.2GB on my laptop running 9.0.4 and compiz. It resets down
to around 400MB if I restart X.

Revision history for this message
Martin Olsson (mnemo) wrote :

Can you correlate the X leaking to any particular type of X resource inside the "xrestop" program?

Revision history for this message
Murz (murznn) wrote :

Confirm this issue on fresh install of Ubuntu Jaunty AMD64 and KDE 4.2.2 or KDE 4.3 Beta 1.

Output of xrestop is attached.
$ ps aux | grep X
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2755 21.8 20.3 815752 617420 tty7 Ss+ 09:59 107:16 /usr/bin/X -br -nolisten tcp :0 vt7 -auth /var/run/xauth/A:0-iUW6TE

and htop command says that /usr/bin/X process uses 1058M of VIRT and 563M of RES (19.0% of 3GB memory).

Revision history for this message
Murz (murznn) wrote :

What additional info I can give you for describing this bug?

Revision history for this message
Martin Olsson (mnemo) wrote :

@Murz, installing debug symbols for the X server (xserver-xorg-core-dbg package) and then running it under valgrind with the --leak-check=full parameter might be sufficient to pin point a malloc/free mismatch. I have never tried this myself though; I have no idea if it's useful in practice for the X server but I think so..

Revision history for this message
mollitz (mollitz) wrote :

he,
this is my valgrind log file. Command: valgrind --log-file=vdebug.log --leak-check=full startx > xdebug.log
vdebug.log is attachted, but not very helpful i think. is my command wrong?

Revision history for this message
In , Daniel Stone (daniels) wrote :

seems to be fine these days ...

Changed in xorg-server:
status: Confirmed → Invalid
Revision history for this message
Boerny (b-stader) wrote :

I have the same problem and took also an xrestop snapshot.
Looks like plasma-desktop is eating up memory. But when i use top its seams xorg is eating it.
-- snippet from output of top
 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
 2270 bernhard 20 0 1020m 97m 17m S 9 4.9 6:29.28 plasma-desktop
 2268 bernhard 20 0 555m 20m 11m S 5 1.0 19:04.35 kwin
 1353 root 20 0 4884m 1.0g 3468 S 3 52.4 6:43.74 Xorg
 2304 bernhard 20 0 701m 23m 13m S 1 1.2 2:11.15 krunner

Revision history for this message
Eric Brasseur (eric-brasseur-gmail) wrote :

Hello,

Disabling xinerama worked for me too.

On ubuntu 9.04 (using an Intel GMA chipset), I added this at the bottom of my /etc/X11/xorg.conf file and then had no more problem after restarting the X server:

Section "Serverflags"
    Option "Xinerama" "false"
Endsection

Revision history for this message
Bryce Harrington (bryce) wrote :

[This is an automatic notification.]

Hi Lukas,

This bug was reported against an earlier version of Ubuntu, can you
test if it still occurs on Lucid?

Please note we also provide technical support for older versions of
Ubuntu, but not in the bug tracker. Instead, to raise the issue through
normal support channels, please see:

    http://www.ubuntu.com/support

If you are the original reporter and can still reproduce the issue on
Lucid, please run the following command to refresh the report:

  apport-collect 186354

If you are not the original reporter, please file a new bug report, so
we can work with you as the original reporter instead (you can reference
bug 186354 in your report if you think it may be related):

  ubuntu-bug xorg

If by chance you can no longer reproduce the issue on Lucid or if you
feel it is no longer relevant, please mark the bug report 'Fix Released'
or 'Invalid' as appropriate, at the following URL:

  https://bugs.launchpad.net/ubuntu/+bug/186354

Changed in xorg-server (Ubuntu):
status: Triaged → Incomplete
tags: added: needs-retested-on-lucid-by-june
Revision history for this message
Lukas Hejtmanek (xhejtman) wrote :

I don't see this problem any more.

Revision history for this message
Murz (murznn) wrote :

I don't see it too on Lucid at now:
# ps aux | grep X
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 9599 5.0 0.8 149052 33864 tty7 Ss+ May02 340:29 /usr/bin/X -nr -nolisten tcp :0 vt7 -auth /var/run/xauth/A:0-7SRb1a
# uptime
 19:34:48 up 4 days, 18:10, 6 users, load average: 0.25, 0.41, 0.49

~about 33mb

Revision history for this message
Adam Porter (alphapapa) wrote :

I'm using Kubuntu Lucid amd64 with KDE4, an ATI Radeon HD 4770 with fglrx drivers. X seems to be leaking a lot of memory. When I first log in to a KDE session my system RAM usage is around 650 MB. After a day or so of normal usage, and then closing all apps that weren't running right after I logged in, my RAM usage is around 1400 MB. X is using more than any other process on the system by far, and it's 13.1% of my 4 GB of RAM. If I log out and back in, RAM usage goes back to around 650 MB.

This problem doesn't seem to exist in Kubuntu Hardy.

# ps aux | grep X
 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1048 3.3 13.0 690928 528600 tty7 Ss+ 02:41 22:28 /usr/bin/X...

Changed in xorg-server (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Adam Porter (alphapapa) wrote :

Correction, logging out and back in doesn't reduce the X process's memory usage. When I log back in, it's the same X process PID, and RSS is about the same. If I log out, restart X, and log back in, it's back to normal usage. For example, just now I restarted X, loaded Konqueror, and came to this bug's page.

# ps aux | grep X
  USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 8918 7.5 2.6 220520 108072 tty7 Ss+ 14:09 0:14 /usr/bin/X

Still seems like a lot to me, but it's certainly better than the 500+ MB it was using before.

Revision history for this message
Robert Hooker (sarvatt) wrote :

Adam Porter: Please file a new bug (using ubuntu-bug xorg), the original reporter says this is not an issue anymore and you problem needs logs to analyze and is most likely different.

Changed in xorg-server (Ubuntu):
status: Confirmed → Fix Released
Changed in xorg-server:
importance: Unknown → Medium
Changed in xorg-server:
importance: Medium → Unknown
Changed in xorg-server:
importance: Unknown → Medium
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.