[SOLVED] Memory leak in kwin and xorg after Xorg security updates

Hello,

since the Xorg/nvidia security updates of the last weeks, I encounter a problem with growing Xorg and kwin memory usage in KDE.
In one hour the memory consumption is at Xorg ~ 270 MiB and at kwin: 300 MB , so the system responds slowly and scrolling is very slow in in dolphin, kwrite, firefox, etc.
After several hours the system is so slow, that only a restart helps, and then the growing of memory starts again.

*** My Tests;

I tried several nvidia drivers, but without success.
(from: https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa/+index?field.series_filter=precise)

304.125-0ubuntu0.0.1~xedgers12.04.1
331.113-0ubuntu0.0.1~xedgers12.04.1
346.22-0ubuntu1~xedgers12.04.1
(With purging each nvidia driver and fresh installing it)

*** My configuration;

Two Kubuntu 12.04.5 PCs with a nvidia card (GT 430 and NVS300); KDE 4.8.5
nvidia driver 331.113-0ubuntu0.0.0.3 and 304.125-0ubuntu0.0.0.1
One pc with the Trusty Xstack (HWE, xserver 1.15.1) with Trusty kernel (3.13.0-43.72~precise1) and the other one with the stock kernel (3.2.0-74-generic #109) and stock xstack.

I use one pc in my office, so it disturbs my work because of the slowness and restarts.

Furthermore I opened a ubuntu bug report, but at the moment there is no progress.
https://bugs.launchpad.net/ubuntu/+source/xorg-server-lts-trusty/+bug/1402551

There are no error messages in Xorg or syslog.

You can easily reproduce this, when you start in KDE the system monitor krunner (Ctrl+Esc), then search for kwin.
Do not start other applications and watch the process memory growing.

Thank you for your help!

Best regards, Bernhard

*** Nvidia Drivers;

nvidia-graphics-drivers-331 (331.113-0ubuntu0.0.0.3)
nvidia-graphics-drivers-304-updates (304.125-0ubuntu0.0.0.1)

*** Security updates of the problematic packages and other Xorg deps

http://lists.x.org/archives/xorg-announce/2014-December/002506.html

nvidia-graphics-drivers-331 (331.113-0ubuntu0.0.0.3) precise-security; urgency=medium

[ Alberto Milone ]

  • debian/substvars:
    • Add support for video ABIs up to 19.
  • debian/templates/dkms_nvidia.conf.in:
    • Drop all the patches.
  • SECURITY UPDATE:
    • CVE-2014-8091, CVE-2014-8098, CVE-2014-8298 (LP: #1400673).
      – Alberto Milone Tue, 09 Dec 2014 12:10:46 +0100

CVE-2014-8298 RESERVED
CVE-2014-8098 out of bounds access in GLX extension
CVE-2014-8091 denial of service due to unchecked malloc in client authentication

nvidia-graphics-drivers-304-updates (304.125-0ubuntu0.0.0.1)

xorg-server-lts-trusty (2:1.15.1-0ubuntu2~precise4) precise-security; urgency=medium

  • SECURITY UPDATE: Dec 2014 security issues - additional fixes
    • debian/patches/CVE-2014-8xxx/003[4567]*.patch: add additional
      fixes not included in original pre-advisory bundle.
      – Marc Deslauriers Tue, 09 Dec 2014 17:25:15 -0500

xorg-server-lts-trusty (2:1.15.1-0ubuntu2~precise3) precise-security; urgency=medium

  • SECURITY UPDATE: Dec 2014 protocol handling security issues
    • debian/patches/CVE-2014-8xxx/*.patch: patches from upstream to fix
      a multitude of security issues, including a couple of pre-requisite
      fixes from git.
    • CVE-2014-8091
    • CVE-2014-8092
    • CVE-2014-8093
    • CVE-2014-8094
    • CVE-2014-8095
    • CVE-2014-8096
    • CVE-2014-8097
    • CVE-2014-8098
    • CVE-2014-8099
    • CVE-2014-8100
    • CVE-2014-8101
    • CVE-2014-8102
    • CVE-2014-8103
      – Marc Deslauriers Sat, 06 Dec 2014 10:28:55 -0500

CVE-2014-8091 denial of service due to unchecked malloc in client authentication
CVE-2014-8092 intger overflows in X11 core protocol requests
CVE-2014-8093 integer overflows in GLX extension
CVE-2014-8094 integer overflows in DRI2 extensions
CVE-2014-8095 out of bounds access in XInput extensions
CVE-2014-8096 out of bounds access in XC-MISC extension
CVE-2014-8097 out of bounds access in DBE extension
CVE-2014-8098 out of bounds access in GLX extension
CVE-2014-8099 out of bounds access in XVideo extension
CVE-2014-8100 out of bounds access in Render extension
CVE-2014-8101 out of bounds access in RandR extension
CVE-2014-8102 out of bounds access in XFixes extension
CVE-2014-8103 out of bounds access in DRI3 & Present extensions

and other Xorg deps
nvidia-driver-304.txt (5.4 KB)
nvidia-driver-331.txt (4.21 KB)
xorg-server.txt (1.61 KB)
apt-history-upgraded_packages.txt (26.3 KB)
nvidia-bug-report.log.gz (75.6 KB)

Please provide nvidia-bug-report by running nvidia-bug-report.sh script as root user.
What are the packages you patched ?
Is the issue repro with clean Os installation?
Please provide step-by-step reproduction steps ?
From where I can download and apply these patches?
Please provide whatever extra information needed to reproduce this issue for investigation.

**** What are the packages you patched ? From where I can download and apply these patches?

The problematic packages are the Xorg/nvidia security updates of the last weeks beginning with Dec 6th 2014 in the Ubuntu 12.04 repository.
(A detailed package list is attached)

http://packages.ubuntu.com/precise/nvidia-304-updates
Version 304.125-0ubuntu0.0.0.1

http://packages.ubuntu.com/precise/nvidia-331-updates
Version 331.113-0ubuntu0.0.0.3

http://packages.ubuntu.com/precise-updates/xserver-xorg-core
1.11.4-0ubuntu10.16 and 1.15.1-0ubuntu2~precise4
(and many other xorg dependencies)

Changelog and download links are on the right side of the webpage.

**** Please provide step-by-step reproduction steps ?

Download Kubuntu 12.04.5 (Codename: Precise Pangolin) x86_64 from the following link;

http://cdimage.ubuntu.com/kubuntu/releases/12.04.5/release/

http://cdimage.ubuntu.com/kubuntu/releases/12.04.5/release/kubuntu-12.04.5-desktop-amd64.iso

Make a default installation on a pc with a nvidia graphics card (e.g. GT 430, NVS300)

Update your system

sudo apt-get update && sudo apt-get dist-upgrade

Install the nvidia driver manually via apt (or via the program jockey)

sudo apt-get install nvidia-304-updates
or
sudo apt-get install nvidia-331-updates

reboot and check, if the driver is in use with dmesg , modinfo and nvidia-smi, Xorg.0.log

check for growing process memory of kwin and Xorg

Login to KDE and start the system monitor krunner (Ctrl+Esc), then search for kwin.
Do not start other applications and watch the process memory growing.

In one hour the memory consumption is at Xorg ~ 270 MiB and at kwin: 300 MB , so the system responds slowly and scrolling is very slow in in dolphin, kwrite, firefox, etc.
After several hours the system is so slow, that only a restart helps, and then the growing of memory starts again.

This problem occurred immediately after installing the nvidia/xorg security patches (+reboot) on two PCs with a nvidia graphics card (GT 430 and NVS300)

Both PCs are using the KDE-effects, but I will test this without the effects and give feedback.

**** Please provide whatever extra information needed to reproduce this issue for investigation.

I have tested other drivers from
https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa/+index?field.series_filter=precise
but without success, also the same problem.

331.113-0ubuntu0.0.1~xedgers12.04.1
346.22-0ubuntu1~xedgers12.04.1

I removed the dirs ~/.nv and /var/tmp/kdecache-/ to recreate the kde-cache, but no improvement.

I will provide the information for the other two questions later after testing.

**** Please provide nvidia-bug-report by running nvidia-bug-report.sh script as root user.

**** Is the issue repro with clean Os installation?

Thanks, Bernhard

**** Please provide nvidia-bug-report by running nvidia-bug-report.sh script as root user.

The nvidia-bug-report log is now attached on the original post.

Furthermore I’ve tested KDE without the Compositing-effects. The result is that the memory leak is gone. Only with the enabled effects, the problem occurs.

I will provide the testing with a clean installation in a few days.

Are there any hints to the problem? Is there a memory leak in the nvidia drivers, which is triggered in KDE since the last Xorg security updates?

Please let me know, if you need further logs or other information.

Thanks, Bernhard

KDE (in particular, kwin’s border shadow feature) has traditionally had trouble with memory leaks. If you run xrestop, do you see the number of pixmaps owned by various KDE components increasing over time?

I’m currently looking into this on Debian Testing with KDE, after switching from 340.65 -> 340.58 (Nvidia’s Installer not Debian’s repo’) I don’t appear to be leaking memory anymore in KDE. I’ll wait a few days to confirm though. Also when I checked xrestop with 340.65 (the driver version that’s leaking) it looked like plasma-desktop was the leaking process and not kwin.

I have some results, test is basically asking nvidia-settings for dedicated memory usage and a xrestop output every 10 minutes. I’ll leave someone else to interpret the results. Do note I play games so large jumps in dedicated memory are games being ran.

I’m going to do some much longer runs between 340.58 and the new 340.76 drivers.

xrestop-340.58.txt
######################
## Dedicated Memory ##
######################
2015-01-25 01:46.txt:UsedDedicatedGPUMemory: 102
2015-01-25 01:56.txt:UsedDedicatedGPUMemory: 166
2015-01-25 02:06.txt:UsedDedicatedGPUMemory: 174
2015-01-25 02:16.txt:UsedDedicatedGPUMemory: 496
2015-01-25 02:26.txt:UsedDedicatedGPUMemory: 335
2015-01-25 02:36.txt:UsedDedicatedGPUMemory: 464
2015-01-25 02:46.txt:UsedDedicatedGPUMemory: 490
2015-01-25 02:56.txt:UsedDedicatedGPUMemory: 508
2015-01-25 03:06.txt:UsedDedicatedGPUMemory: 240
2015-01-25 03:16.txt:UsedDedicatedGPUMemory: 434
2015-01-25 03:26.txt:UsedDedicatedGPUMemory: 475
2015-01-25 03:36.txt:UsedDedicatedGPUMemory: 483
2015-01-25 03:46.txt:UsedDedicatedGPUMemory: 589
2015-01-25 03:56.txt:UsedDedicatedGPUMemory: 198
2015-01-25 04:06.txt:UsedDedicatedGPUMemory: 224
2015-01-25 04:16.txt:UsedDedicatedGPUMemory: 225
2015-01-25 04:26.txt:UsedDedicatedGPUMemory: 236
2015-01-25 04:36.txt:UsedDedicatedGPUMemory: 224
2015-01-25 04:46.txt:UsedDedicatedGPUMemory: 245
2015-01-25 04:56.txt:UsedDedicatedGPUMemory: 255
2015-01-25 05:06.txt:UsedDedicatedGPUMemory: 255
2015-01-25 05:16.txt:UsedDedicatedGPUMemory: 255
2015-01-25 05:26.txt:UsedDedicatedGPUMemory: 255
2015-01-25 05:36.txt:UsedDedicatedGPUMemory: 255
2015-01-25 05:46.txt:UsedDedicatedGPUMemory: 255
2015-01-25 05:56.txt:UsedDedicatedGPUMemory: 255
2015-01-25 06:06.txt:UsedDedicatedGPUMemory: 255
2015-01-25 06:16.txt:UsedDedicatedGPUMemory: 255
2015-01-25 06:26.txt:UsedDedicatedGPUMemory: 255
2015-01-25 06:36.txt:UsedDedicatedGPUMemory: 255
2015-01-25 06:46.txt:UsedDedicatedGPUMemory: 255
2015-01-25 06:56.txt:UsedDedicatedGPUMemory: 255
2015-01-25 07:06.txt:UsedDedicatedGPUMemory: 255
2015-01-25 07:16.txt:UsedDedicatedGPUMemory: 255
2015-01-25 07:26.txt:UsedDedicatedGPUMemory: 255
2015-01-25 07:36.txt:UsedDedicatedGPUMemory: 255
2015-01-25 07:46.txt:UsedDedicatedGPUMemory: 255
2015-01-25 07:56.txt:UsedDedicatedGPUMemory: 255
2015-01-25 08:06.txt:UsedDedicatedGPUMemory: 255
2015-01-25 08:16.txt:UsedDedicatedGPUMemory: 255
2015-01-25 08:26.txt:UsedDedicatedGPUMemory: 255
2015-01-25 08:36.txt:UsedDedicatedGPUMemory: 255
2015-01-25 08:46.txt:UsedDedicatedGPUMemory: 268
2015-01-25 08:56.txt:UsedDedicatedGPUMemory: 268
2015-01-25 09:06.txt:UsedDedicatedGPUMemory: 252
2015-01-25 09:16.txt:UsedDedicatedGPUMemory: 257
2015-01-25 09:26.txt:UsedDedicatedGPUMemory: 257
2015-01-25 09:36.txt:UsedDedicatedGPUMemory: 257

############################################
## Plasma Desktop - Total Bytes - xrestop ##
############################################
2015-01-25 01:46.txt-   total bytes   : ~16085084
2015-01-25 01:56.txt-   total bytes   : ~18893956
2015-01-25 02:06.txt-   total bytes   : ~19156964
2015-01-25 02:16.txt-   total bytes   : ~19189492
2015-01-25 02:26.txt-   total bytes   : ~19208640
2015-01-25 02:36.txt-   total bytes   : ~19182260
2015-01-25 02:46.txt-   total bytes   : ~19178876
2015-01-25 02:56.txt-   total bytes   : ~19208724
2015-01-25 03:06.txt-   total bytes   : ~19295852
2015-01-25 03:16.txt-   total bytes   : ~19260920
2015-01-25 03:26.txt-   total bytes   : ~19273240
2015-01-25 03:36.txt-   total bytes   : ~19266088
2015-01-25 03:46.txt-   total bytes   : ~19273240
2015-01-25 03:56.txt-   total bytes   : ~19352224
2015-01-25 04:06.txt-   total bytes   : ~19877100
2015-01-25 04:16.txt-   total bytes   : ~19862944
2015-01-25 04:26.txt-   total bytes   : ~19946228
2015-01-25 04:36.txt-   total bytes   : ~19984540
2015-01-25 04:46.txt-   total bytes   : ~19986076
2015-01-25 04:56.txt-   total bytes   : ~20417896
2015-01-25 05:06.txt-   total bytes   : ~20411680
2015-01-25 05:16.txt-   total bytes   : ~20411680
2015-01-25 05:26.txt-   total bytes   : ~20411680
2015-01-25 05:36.txt-   total bytes   : ~20411680
2015-01-25 05:46.txt-   total bytes   : ~20411680
2015-01-25 05:56.txt-   total bytes   : ~20411680
2015-01-25 06:06.txt-   total bytes   : ~20411680
2015-01-25 06:16.txt-   total bytes   : ~20403192
2015-01-25 06:26.txt-   total bytes   : ~20410632
2015-01-25 06:36.txt-   total bytes   : ~20410632
2015-01-25 06:46.txt-   total bytes   : ~20410632
2015-01-25 06:56.txt-   total bytes   : ~20411680
2015-01-25 07:06.txt-   total bytes   : ~20558968
2015-01-25 07:16.txt-   total bytes   : ~20453604
2015-01-25 07:26.txt-   total bytes   : ~20558968
2015-01-25 07:36.txt-   total bytes   : ~20558968
2015-01-25 07:46.txt-   total bytes   : ~20559392
2015-01-25 07:56.txt-   total bytes   : ~20559392
2015-01-25 08:06.txt-   total bytes   : ~20559392
2015-01-25 08:16.txt-   total bytes   : ~20559392
2015-01-25 08:26.txt-   total bytes   : ~20559392
2015-01-25 08:36.txt-   total bytes   : ~20559392
2015-01-25 08:46.txt-   total bytes   : ~20471428
2015-01-25 08:56.txt-   total bytes   : ~20559992
2015-01-25 09:06.txt-   total bytes   : ~20592424
2015-01-25 09:16.txt-   total bytes   : ~20592424
2015-01-25 09:26.txt-   total bytes   : ~20592424
2015-01-25 09:36.txt-   total bytes   : ~20600664

##################################
## kwin - Total Bytes - xrestop ##
##################################
2015-01-25 01:46.txt-   total bytes   : ~20376650
2015-01-25 01:56.txt-   total bytes   : ~38033084
2015-01-25 02:06.txt-   total bytes   : ~42658749
2015-01-25 02:16.txt-   total bytes   : ~46801196
2015-01-25 02:26.txt-   total bytes   : ~50835196
2015-01-25 02:36.txt-   total bytes   : ~50946812
2015-01-25 02:46.txt-   total bytes   : ~50946812
2015-01-25 02:56.txt-   total bytes   : ~50963388
2015-01-25 03:06.txt-   total bytes   : ~50958268
2015-01-25 03:16.txt-   total bytes   : ~50951028
2015-01-25 03:26.txt-   total bytes   : ~50946908
2015-01-25 03:36.txt-   total bytes   : ~50951028
2015-01-25 03:46.txt-   total bytes   : ~50953364
2015-01-25 03:56.txt-   total bytes   : ~46887996
2015-01-25 04:06.txt-   total bytes   : ~55888916
2015-01-25 04:16.txt-   total bytes   : ~50171348
2015-01-25 04:26.txt-   total bytes   : ~55212644
2015-01-25 04:36.txt-   total bytes   : ~55217956
2015-01-25 04:46.txt-   total bytes   : ~50171684
2015-01-25 04:56.txt-   total bytes   : ~53195405
2015-01-25 05:06.txt-   total bytes   : ~50170780
2015-01-25 05:16.txt-   total bytes   : ~62760316
2015-01-25 05:26.txt-   total bytes   : ~62760316
2015-01-25 05:36.txt-   total bytes   : ~62760316
2015-01-25 05:46.txt-   total bytes   : ~62760316
2015-01-25 05:56.txt-   total bytes   : ~62760316
2015-01-25 06:06.txt-   total bytes   : ~62760316
2015-01-25 06:16.txt-   total bytes   : ~62760316
2015-01-25 06:26.txt-   total bytes   : ~62760364
2015-01-25 06:36.txt-   total bytes   : ~62760364
2015-01-25 06:46.txt-   total bytes   : ~62760364
2015-01-25 06:56.txt-   total bytes   : ~62760412
2015-01-25 07:06.txt-   total bytes   : ~67234108
2015-01-25 07:16.txt-   total bytes   : ~67234156
2015-01-25 07:26.txt-   total bytes   : ~58563868
2015-01-25 07:36.txt-   total bytes   : ~58563868
2015-01-25 07:46.txt-   total bytes   : ~58563868
2015-01-25 07:56.txt-   total bytes   : ~58563868
2015-01-25 08:06.txt-   total bytes   : ~58563868
2015-01-25 08:16.txt-   total bytes   : ~58563868
2015-01-25 08:26.txt-   total bytes   : ~58563868
2015-01-25 08:36.txt-   total bytes   : ~58563868
2015-01-25 08:46.txt-   total bytes   : ~50170878
2015-01-25 08:56.txt-   total bytes   : ~50170782
2015-01-25 09:06.txt-   total bytes   : ~50170782
2015-01-25 09:16.txt-   total bytes   : ~62760318
2015-01-25 09:26.txt-   total bytes   : ~62760318
xrestop-340.65.txt
######################
## Dedicated Memory ##
######################
2015-01-25 15:51.txt:UsedDedicatedGPUMemory: 94
2015-01-25 16:01.txt:UsedDedicatedGPUMemory: 170
2015-01-25 16:11.txt:UsedDedicatedGPUMemory: 170
2015-01-25 16:21.txt:UsedDedicatedGPUMemory: 174
2015-01-25 16:31.txt:UsedDedicatedGPUMemory: 199
2015-01-25 16:41.txt:UsedDedicatedGPUMemory: 199
2015-01-25 16:51.txt:UsedDedicatedGPUMemory: 199
2015-01-25 17:01.txt:UsedDedicatedGPUMemory: 199
2015-01-25 17:11.txt:UsedDedicatedGPUMemory: 174
2015-01-25 17:21.txt:UsedDedicatedGPUMemory: 170
2015-01-25 17:31.txt:UsedDedicatedGPUMemory: 175
2015-01-25 17:41.txt:UsedDedicatedGPUMemory: 289
2015-01-25 17:51.txt:UsedDedicatedGPUMemory: 384
2015-01-25 18:01.txt:UsedDedicatedGPUMemory: 468
2015-01-25 18:11.txt:UsedDedicatedGPUMemory: 420
2015-01-25 18:21.txt:UsedDedicatedGPUMemory: 430
2015-01-25 18:31.txt:UsedDedicatedGPUMemory: 447
2015-01-25 18:41.txt:UsedDedicatedGPUMemory: 505
2015-01-25 18:51.txt:UsedDedicatedGPUMemory: 176
2015-01-25 19:01.txt:UsedDedicatedGPUMemory: 181
2015-01-25 19:11.txt:UsedDedicatedGPUMemory: 181
2015-01-25 19:21.txt:UsedDedicatedGPUMemory: 186
2015-01-25 19:31.txt:UsedDedicatedGPUMemory: 197
2015-01-25 19:41.txt:UsedDedicatedGPUMemory: 251
2015-01-25 19:51.txt:UsedDedicatedGPUMemory: 246
2015-01-25 20:01.txt:UsedDedicatedGPUMemory: 267
2015-01-25 20:11.txt:UsedDedicatedGPUMemory: 239
2015-01-25 20:21.txt:UsedDedicatedGPUMemory: 239
2015-01-25 20:31.txt:UsedDedicatedGPUMemory: 248
2015-01-25 20:41.txt:UsedDedicatedGPUMemory: 248
2015-01-25 20:51.txt:UsedDedicatedGPUMemory: 248
2015-01-25 21:01.txt:UsedDedicatedGPUMemory: 248
2015-01-25 21:11.txt:UsedDedicatedGPUMemory: 248
2015-01-25 21:21.txt:UsedDedicatedGPUMemory: 248
2015-01-25 21:31.txt:UsedDedicatedGPUMemory: 248
2015-01-25 21:41.txt:UsedDedicatedGPUMemory: 248
2015-01-25 21:51.txt:UsedDedicatedGPUMemory: 248
2015-01-25 22:01.txt:UsedDedicatedGPUMemory: 248
2015-01-25 22:11.txt:UsedDedicatedGPUMemory: 248
2015-01-25 22:21.txt:UsedDedicatedGPUMemory: 248
2015-01-25 22:31.txt:UsedDedicatedGPUMemory: 248
2015-01-25 22:41.txt:UsedDedicatedGPUMemory: 248
2015-01-25 22:51.txt:UsedDedicatedGPUMemory: 248
2015-01-25 23:01.txt:UsedDedicatedGPUMemory: 248
2015-01-25 23:11.txt:UsedDedicatedGPUMemory: 248
2015-01-25 23:21.txt:UsedDedicatedGPUMemory: 248
2015-01-25 23:31.txt:UsedDedicatedGPUMemory: 278
2015-01-25 23:41.txt:UsedDedicatedGPUMemory: 279

############################################
## Plasma Desktop - Total Bytes - xrestop ##
############################################
2015-01-25 15:51.txt-   total bytes   : ~17689656
2015-01-25 16:01.txt-   total bytes   : ~21728380
2015-01-25 16:11.txt-   total bytes   : ~21838224
2015-01-25 16:21.txt-   total bytes   : ~21819272
2015-01-25 16:31.txt-   total bytes   : ~21712008
2015-01-25 16:41.txt-   total bytes   : ~21712008
2015-01-25 16:51.txt-   total bytes   : ~21712008
2015-01-25 17:01.txt-   total bytes   : ~21729176
2015-01-25 17:11.txt-   total bytes   : ~21520808
2015-01-25 17:21.txt-   total bytes   : ~21851136
2015-01-25 17:31.txt-   total bytes   : ~21943580
2015-01-25 17:41.txt-   total bytes   : ~22086028
2015-01-25 17:51.txt-   total bytes   : ~21948336
2015-01-25 18:01.txt-   total bytes   : ~21960320
2015-01-25 18:11.txt-   total bytes   : ~21965744
2015-01-25 18:21.txt-   total bytes   : ~22013400
2015-01-25 18:31.txt-   total bytes   : ~22046848
2015-01-25 18:41.txt-   total bytes   : ~22244568
2015-01-25 18:51.txt-   total bytes   : ~22235536
2015-01-25 19:01.txt-   total bytes   : ~22452300
2015-01-25 19:11.txt-   total bytes   : ~22253032
2015-01-25 19:21.txt-   total bytes   : ~24181580
2015-01-25 19:31.txt-   total bytes   : ~24063024
2015-01-25 19:41.txt-   total bytes   : ~24189996
2015-01-25 19:51.txt-   total bytes   : ~24036944
2015-01-25 20:01.txt-   total bytes   : ~24245052
2015-01-25 20:11.txt-   total bytes   : ~24095420
2015-01-25 20:21.txt-   total bytes   : ~24213144
2015-01-25 20:31.txt-   total bytes   : ~24253744
2015-01-25 20:41.txt-   total bytes   : ~24132388
2015-01-25 20:51.txt-   total bytes   : ~24137988
2015-01-25 21:01.txt-   total bytes   : ~24218060
2015-01-25 21:11.txt-   total bytes   : ~24222692
2015-01-25 21:21.txt-   total bytes   : ~24332176
2015-01-25 21:31.txt-   total bytes   : ~24222692
2015-01-25 21:41.txt-   total bytes   : ~24222692
2015-01-25 21:51.txt-   total bytes   : ~24205916
2015-01-25 22:01.txt-   total bytes   : ~24125524
2015-01-25 22:11.txt-   total bytes   : ~24069184
2015-01-25 22:21.txt-   total bytes   : ~24069184
2015-01-25 22:31.txt-   total bytes   : ~24072432
2015-01-25 22:41.txt-   total bytes   : ~24156196
2015-01-25 22:51.txt-   total bytes   : ~24029232
2015-01-25 23:01.txt-   total bytes   : ~24279452
2015-01-25 23:11.txt-   total bytes   : ~24158584
2015-01-25 23:21.txt-   total bytes   : ~24156144
2015-01-25 23:31.txt-   total bytes   : ~24156144
2015-01-25 23:41.txt-   total bytes   : ~24364276

##################################
## kwin - Total Bytes - xrestop ##
##################################
2015-01-25 15:51.txt-   total bytes   : ~17951731
2015-01-25 16:01.txt-   total bytes   : ~37516580
2015-01-25 16:11.txt-   total bytes   : ~44249120
2015-01-25 16:21.txt-   total bytes   : ~39905389
2015-01-25 16:31.txt-   total bytes   : ~52494925
2015-01-25 16:41.txt-   total bytes   : ~52494925
2015-01-25 16:51.txt-   total bytes   : ~52494925
2015-01-25 17:01.txt-   total bytes   : ~53322187
2015-01-25 17:11.txt-   total bytes   : ~40732675
2015-01-25 17:21.txt-   total bytes   : ~39920605
2015-01-25 17:31.txt-   total bytes   : ~44966853
2015-01-25 17:41.txt-   total bytes   : ~43360943
2015-01-25 17:51.txt-   total bytes   : ~44125919
2015-01-25 18:01.txt-   total bytes   : ~44130037
2015-01-25 18:11.txt-   total bytes   : ~44118159
2015-01-25 18:21.txt-   total bytes   : ~44125991
2015-01-25 18:31.txt-   total bytes   : ~44125989
2015-01-25 18:41.txt-   total bytes   : ~46978371
2015-01-25 18:51.txt-   total bytes   : ~42758653
2015-01-25 19:01.txt-   total bytes   : ~51905216
2015-01-25 19:11.txt-   total bytes   : ~43723235
2015-01-25 19:21.txt-   total bytes   : ~44684143
2015-01-25 19:31.txt-   total bytes   : ~44706285
2015-01-25 19:41.txt-   total bytes   : ~44707333
2015-01-25 19:51.txt-   total bytes   : ~44037205
2015-01-25 20:01.txt-   total bytes   : ~46023150
2015-01-25 20:11.txt-   total bytes   : ~46020006
2015-01-25 20:21.txt-   total bytes   : ~46018982
2015-01-25 20:31.txt-   total bytes   : ~46003877
2015-01-25 20:41.txt-   total bytes   : ~50788029
2015-01-25 20:51.txt-   total bytes   : ~56750973
2015-01-25 21:01.txt-   total bytes   : ~56750973
2015-01-25 21:11.txt-   total bytes   : ~56750973
2015-01-25 21:21.txt-   total bytes   : ~56750973
2015-01-25 21:31.txt-   total bytes   : ~56750973
2015-01-25 21:41.txt-   total bytes   : ~44161437
2015-01-25 21:51.txt-   total bytes   : ~44161485
2015-01-25 22:01.txt-   total bytes   : ~55068306
2015-01-25 22:11.txt-   total bytes   : ~51473610
2015-01-25 22:21.txt-   total bytes   : ~51473610
2015-01-25 22:31.txt-   total bytes   : ~55946746
2015-01-25 22:41.txt-   total bytes   : ~54371944
2015-01-25 22:51.txt-   total bytes   : ~59877624
2015-01-25 23:01.txt-   total bytes   : ~63366590
2015-01-25 23:11.txt-   total bytes   : ~63366639
2015-01-25 23:21.txt-   total bytes   : ~56347952
2015-01-25 23:31.txt-   total bytes   : ~56347952
  • I have tested a fresh installation (via usb-stick) of Kubuntu 12.04.x with nvidia driver 331.113-0ubuntu0.0.0.3 and 304.125-0ubuntu0.0.0.1 , but I cannot reproduce the problem there (a few hours of testing).

But with a fresh user on the affected installation, the memory leak occurs.

  • On my Office PC (12.04.x) with nvs300 the problem is gone, but I don’t know why. (nvidia driver 304.125-0ubuntu0.0.0.1)
    There was a kernel update linux-image-3.2.0-75-generic, but I don’t know if this is connected. I installed and reinstalled several times different kernels.
    changelog
    linux (3.2.0-75.110) precise; urgency=low

    [ Kamal Mostafa ]

    • Release Tracking Bug
      • LP: #1403154

    [ Upstream Kernel Changes ]

    • kvm: fix excessive pages un-pinning in kvm_iommu_map error path.
      • LP: #1386395
      • CVE-2014-8369
    • KVM: x86: Don’t report guest userspace emulation error to userspace
      • LP: #1392823
      • CVE-2014-7842
    • drivers:scsi:storvsc: Fix a bug in handling ring buffer failures that
      may result in I/O freeze
      • LP: #1400289
    • net:socket: set msg_namelen to 0 if msg_name is passed as NULL in
      msghdr struct from userland.
      • LP: #1335478

– Kamal Mostafa kamal@canonical.com Tue, 16 Dec 2014 10:00:12 -0800

  • On my Home PC (GT 430) the problem is still there;

That’s why I have upgraded to the latest Ubuntu LTS version 14.04.x
There I installed the Utopic(14.10) kernel (3.16) with the Utopic xstack (Xserver 1.16.x) with latest nvidia 346.35 driver (with the default settings), but still the problem, but now with a crash after growing of kwin and xorg.
*** xrestop measurements

Memory consumption after ~ 16 hours of normal working, then after 30 min after the xrestop measurement => crash and restart of the xserver (log attached)
(Full HD resolution with KDE-effects enabled (on the office pc I have exactly the same effects with the same settings)).
kwin:
Memory: 218,3 MiB
Shared: 98,5 MiB

Xorg
Memory: 217,2 MiB
Shared: 78,7 MiB

plasma-desktop
Memory: 125,4 MiB
Shared: 91,6 MiB

xrestop - Display: localhost
Monitoring 44 clients. XErrors: 0
Pixmaps: 209917K total, Other: 152K total, All: 210070K total

res-base Wins GCs Fnts Pxms Misc Pxm mem Other Total PID Identifier
2000000 84 14 0 1593 1903 142735K 46K 142782K 2732 kwin

[ 6422.217] (EE) Backtrace:
[ 6422.221] (EE) 0: /usr/bin/X (xorg_backtrace+0x48) [0x7f7dcd5bde88]
[ 6422.221] (EE) 1: /usr/bin/X (0x7f7dcd419000+0x1a8ea9) [0x7f7dcd5c1ea9]
[ 6422.221] (EE) 2: /lib/x86_64-linux-gnu/libc.so.6 (0x7f7dcb599000+0x36d40) [0x7f7dcb5cfd40]
[ 6422.221] (EE) 3: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x5a1d96) [0x7f7dc582ad96]
[ 6422.221] (EE) 4: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x57fb79) [0x7f7dc5808b79]
[ 6422.221] (EE) 5: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x134922) [0x7f7dc53bd922]
[ 6422.221] (EE) 6: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x1388f7) [0x7f7dc53c18f7]
[ 6422.221] (EE) 7: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x136e29) [0x7f7dc53bfe29]
[ 6422.221] (EE) 8: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x12f4b2) [0x7f7dc53b84b2]
[ 6422.221] (EE) 9: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x1376e9) [0x7f7dc53c06e9]
[ 6422.221] (EE) 10: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x13a3bb) [0x7f7dc53c33bb]
[ 6422.221] (EE) 11: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x112722) [0x7f7dc539b722]
[ 6422.221] (EE) 12: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7f7dc5289000+0x5705a3) [0x7f7dc57f95a3]
[ 6422.221] (EE) 13: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/libglx.so (0x7f7dc8c26000+0x6ed9fb) [0x7f7dc93139fb]
[ 6422.221] (EE)
[ 6422.221] (EE) Segmentation fault at address 0x0
[ 6422.221] (EE)
Fatal server error:
[ 6422.221] (EE) Caught signal 11 (Segmentation fault). Server aborting

Thanks, Bernhard

crash_Xorg.0.log.old.txt (28.5 KB)

I have attached another crash-log. This occurred after resume from hibernate (suspend to disk);

[ 36957.374] (II) NVIDIA(0): Setting mode “DFP-0:nvidia-auto-select”
[ 36957.413] (EE) NVIDIA(0): Failed to allocate primary buffer: out of memory.
[ 36957.414] (EE) NVIDIA(0): *** Aborting ***
[ 36957.463] (II) NVIDIA(GPU-0): Display (Idek Iiyama PL2374HD (DFP-0)) does not support NVIDIA
[ 36957.463] (II) NVIDIA(GPU-0): 3D Vision stereo.
[ 36957.463] (EE)
[ 36957.463] (EE) Backtrace:
[ 36957.467] (EE) 0: /usr/bin/X (xorg_backtrace+0x48) [0x7fe7571e1e18]
[ 36957.467] (EE) 1: /usr/bin/X (0x7fe75703d000+0x1a8e59) [0x7fe7571e5e59]
[ 36957.467] (EE) 2: /lib/x86_64-linux-gnu/libc.so.6 (0x7fe7551bd000+0x36d40) [0x7fe7551f3d40]
[ 36957.467] (EE) 3: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7fe74f41f000+0x87b26) [0x7fe74f4a6b26]
[ 36957.467] (EE) 4: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7fe74f41f000+0x5772f7) [0x7fe74f9962f7]
[ 36957.467] (EE) 5: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7fe74f41f000+0x57b7b4) [0x7fe74f99a7b4]
[ 36957.468] (EE) 6: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7fe74f41f000+0x5897a2) [0x7fe74f9a87a2]
[ 36957.468] (EE) 7: /usr/lib/x86_64-linux-gnu/xorg/extra-modules/nvidia_drv.so (0x7fe74f41f000+0x581671) [0x7fe74f9a0671]
[ 36957.468] (EE) 8: /usr/bin/X (xf86VTEnter+0x10b) [0x7fe7570ce4bb]
[ 36957.468] (EE) 9: /usr/bin/X (WakeupHandler+0x6d) [0x7fe757094cdd]
[ 36957.468] (EE) 10: /usr/bin/X (WaitForSomething+0x1bf) [0x7fe7571df36f]
[ 36957.468] (EE) 11: /usr/bin/X (0x7fe75703d000+0x530f1) [0x7fe7570900f1]
[ 36957.468] (EE) 12: /usr/bin/X (0x7fe75703d000+0x571ea) [0x7fe7570941ea]
[ 36957.468] (EE) 13: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xf5) [0x7fe7551deec5]
[ 36957.468] (EE) 14: /usr/bin/X (0x7fe75703d000+0x4276e) [0x7fe75707f76e]
[ 36957.468] (EE)
[ 36957.469] (EE) Segmentation fault at address 0x25
[ 36957.469] (EE)
Fatal server error:
[ 36957.469] (EE) Caught signal 11 (Segmentation fault). Server aborting
[ 36957.469] (EE)
[ 36957.469] (EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
[ 36957.469] (EE) Please also check the log file at “/var/log/Xorg.0.log” for additional information.
[ 36957.469] (EE)
[ 36957.621] (EE) Server terminated with error (1). Closing log file.

nvidia_crash_Xorg.0.log.old-new-after-resume-from-hibernate.txt (44.3 KB)

Okay so I collected a bit of data on the current and previous version that was considered not to have the leak and here are the results:

340.58 Day 1:

2015-02-03 21:47-ded.txt:UsedDedicatedGPUMemory: 265

2015-02-03 21:47-xres.txt:0 - kwin ( PID: 2140 ):
2015-02-03 21:47-xres.txt-      pixmap bytes  : 61540962
2015-02-03 21:47-xres.txt-      other bytes   : ~19632
2015-02-03 21:47-xres.txt-      total bytes   : ~61560594

2015-02-03 21:47-xres.txt:1 - plasma-desktop ( PID: 2159 ):
2015-02-03 21:47-xres.txt-      pixmap bytes  : 24825532
2015-02-03 21:47-xres.txt-      other bytes   : ~30216
2015-02-03 21:47-xres.txt-      total bytes   : ~2485574


340.58 Day 4:

2015-02-06 02:37-ded.txt:UsedDedicatedGPUMemory: 441

2015-02-06 02:37-xres.txt:0 - kwin ( PID: 2140 ):
2015-02-06 02:37-xres.txt-      pixmap bytes  : 70982278
2015-02-06 02:37-xres.txt-      other bytes   : ~29784
2015-02-06 02:37-xres.txt-      total bytes   : ~71012062

2015-02-06 02:37-xres.txt:1 - plasma-desktop ( PID: 2159 ):
2015-02-06 02:37-xres.txt-      pixmap bytes  : 29142052
2015-02-06 02:37-xres.txt-      other bytes   : ~37176
2015-02-06 02:37-xres.txt-      total bytes   : ~29179228




340.76 Day 1:

2015-01-29 00:38.txt:UsedDedicatedGPUMemory: 241

2015-01-29 00:38.txt:0 - kwin ( PID: 2163 ):
2015-01-29 00:38.txt-   pixmap bytes  : 41346821
2015-01-29 00:38.txt-   other bytes   : ~18192
2015-01-29 00:38.txt-   total bytes   : ~41365013

2015-01-29 00:38.txt:1 - plasma-desktop ( PID: 2186 ):
2015-01-29 00:38.txt-   pixmap bytes  : 24375536
2015-01-29 00:38.txt-   other bytes   : ~31104
2015-01-29 00:38.txt-   total bytes   : ~24406640


340.76 Day 7:

2015-02-03 09:38.txt:UsedDedicatedGPUMemory: 910

2015-02-03 00:38.txt:1 - kwin ( PID: 2163 ):
2015-02-03 00:38.txt-   pixmap bytes  : 52452812
2015-02-03 00:38.txt-   other bytes   : ~47304
2015-02-03 00:38.txt-   total bytes   : ~52500116

2015-02-03 00:38.txt:3 - plasma-desktop ( PID: 2186 ):
2015-02-03 00:38.txt-   pixmap bytes  : 31428816
2015-02-03 00:38.txt-   other bytes   : ~47736
2015-02-03 00:38.txt-   total bytes   : ~31476552

Now I realise the time periods between the drivers isn’t the same 340.76 got 7 days and 340.58 only got 4. But I am still hoping these are good enough to show evidence of some sort of leak. I obviously can’t paste the entire dumps for both size and the fact they have either all my processes listed or all my window titles. I’m going to stop collecting information here unless I get asked by nvidia for additional information. I’m pretty confident something changed between 340.58 and 340.76 though considering the huge amount of in use dedicated memory at the end of my samples…

Still no luck with the latest nvidia driver 346.47!

Furthermore I have tested a fresh installation with Kubuntu 14.04.2 Install-DVD with a complete wipe-out of all partitions of the SSD , but the problem occurs there too.

Same problem with nvidia-349.12 driver and kernel 3.19.x.

just to add to the tribulations,
I have a Dell XPS M1330 which was running kubuntu 14.04 quite nicely up until I tried to get Firefox working with WebGL.
I updated the system to jump from firefox 32 (I think) to firefox 36 (where WebGL was supported) and then discovered I had to install the nvidia driver for X11. Now I find that every time I suspend to RAM and then resume, then my X11 server dies with the
same error:

[ 36957.413] (EE) NVIDIA(0): Failed to allocate primary buffer: out of memory.
[ 36957.414] (EE) NVIDIA(0): *** Aborting ***

Google found a resource that suggests adding the “nopat” option to the kernel boot line in grub. I added that yesterday so will see if there is any change today.

for reference,
nvidia driver version is 331.113
kernel is 3.13.0-46-generic #77-Ubuntu SMP i686

The “nopat” option didn’t seem to do it, assuming I added it right.

But what does seem to work is switching to the console with Ctrl-Alt-F1 and then shutting the lid.
When it powers back up just switch back to Ctrl-Alt-F7 and unlock the display manager.

Even switching to console mode didn’t work more than once.
I discovered that in the KDE “system settings” -> “Driver Management” I actually had a selection
of 6 different display drivers.
Currently everything is working normally under
“NVIDIA legacy binary driver version 304.125 from nvidia-304-updates”

It has suspended and resumed twice with no ill effects and even WebGL seems okay in firefox.

Thank you for the hint!

As you have mentioned, the option nopat did not solve the problem, I have tested it too.

I don’t know why this problem is still there, because on another PC with a nvidia card, the problem is gone, but I don’t know why.

A fresh installation does not help, only turning off the kde effects helps. There I have tested different options raster/native, all opengl versions, etc, but without success.

Maybe the problem is dependent on the hardware model (GeForce GT 430), but it ran fine for years, but after the Xorg Security Patches the problem started.

I have tested the KDE effects in Kubuntu 14.04.x (KDE 4.13.3);

When I disable the following KDE effects, the memory leak is not occurring.

Cover-Switch (in german: 3D-Fenstergalerie) and Flip Switch (3D-Fensterstapel)

This is the result of testing for one week.
The memory usage of the graphics card (nvidia-smi) stays normal and the kwin process usage grows to ~ 100 MiB RAM (2K:2560x1440) and also frees memory back, if windows are closed. Xorg process at ~ 100 MiB.

I will test this further, but I think these two effects are the culprits.

This problem is only with the nvidia binary driver (tested until 352.09), it is not with the driver nouveau, intel, radeon (fglrx not tested).