Bug 498357 - Xvfb leaks memory on server regeneration
Summary: Xvfb leaks memory on server regeneration
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: xorg-x11-server
Version: 5.3
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Adam Jackson
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks: 743405 807972
TreeView+ depends on / blocked
 
Reported: 2009-04-30 03:34 UTC by daryl herzmann
Modified: 2018-11-27 21:40 UTC (History)
14 users (show)

Fixed In Version: xorg-x11-server-1.1.1-48.98.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-08 07:39:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
valgrind output (10.59 KB, text/plain)
2009-05-15 19:59 UTC, daryl herzmann
no flags Details
rhel6.2 valgrind output (313.17 KB, text/x-log)
2012-01-30 01:14 UTC, daryl herzmann
no flags Details
pmap log (102.50 KB, text/x-log)
2012-09-19 15:55 UTC, Michael Boisvert
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0083 0 normal SHIPPED_LIVE xorg-x11-server bug fix update 2013-01-07 15:26:52 UTC

Description daryl herzmann 2009-04-30 03:34:15 UTC
I recently migrated a weather image production machine from RHEL4 to RHEL5 (clean install).  I use Xvfb as a display for GEMPAK[1] to connect to in order to render images via many cron scripts.

On RHEL5, I find the memory usage of Xvfb steadily growing...  Maybe 50 MB per day.  I start Xvfb like so:

Xvfb :1 -screen 0 1280x1024x24

Anyway I can help debug this problem?  I have both a x86_64 and x86 machine exhibiting this issue.

thanks!
 daryl

[1] http://www.unidata.ucar.edu/software/gempak/

Comment 1 Matěj Cepl 2009-05-15 19:25:41 UTC
Thanks for the bug report.  We have reviewed the information you have provided above, and there is some additional information we require that will be helpful in our diagnosis of this issue.

Could you please try to run Xvfb under valgrind and attach the resulting logs to this issue as an uncompressed attachment?

We will review this issue again once you've had a chance to attach this information.

Thanks in advance.

Comment 2 daryl herzmann 2009-05-15 19:59:21 UTC
Created attachment 344230 [details]
valgrind output

Thanks for the help.  I hope I ran this correctly:

valgrind --tool=memcheck --leak-check=full Xvfb :1 -screen 0 1280x1024x24

If not, my appologies and thanks!

Comment 3 Adam Jackson 2009-05-15 20:15:48 UTC
That looks like you just launched Xvfb and shut it down.  You should run gempak against it too, so we can see what the memory usage is like in the situation where you're encountering leaks.

Comment 4 daryl herzmann 2009-05-15 20:18:52 UTC
Hi Adam,

I did, each time you see 'FreeFontPath:' blah blah, GEMPAK was run once.

daryl

Comment 5 daryl herzmann 2009-06-01 12:22:30 UTC
Greetings,

Is there any more information I could provide you folks?

thanks,
  daryl

Comment 6 bhoch 2009-06-24 14:51:11 UTC
I also experience problems with xvfb.  Running xorg-x11-server-Xvfb.x86_64                                        1.1.1-48.52.el5  under kernel 2.6.18-128.1.6.el5.  When the system boots, xvfb crashes and needs to be restarted every 60-90 seconds until it becomes stable, sometime after 6+ hours.  We use xvfb in conjunction with WXP see http://wxp.unisys.com/  

I notice that Fedora 11 is up to version xorg-x11-server-Xvfb-1.6.1.901-1, wondering if some or all of those changes could be implemented under RHEL.

Xvfb is a package in heavy use by the university meteorology community for the automatic generation of weather maps and other products, prompt fix of this issue is greatly appreciated.

Thanks,
Brendon

Comment 7 Jim 2009-07-01 13:57:28 UTC
I can echo Brendon's comments above. I am one of the big users on that machine and the other day, when I was placing high demands on xvfb, it was crashing in less than a minute. I finally had to run our checkxvfb script, which would restart it after a crash, before I generated my graphic, which needed Xvfb. I generated thousands of images for a research project and it had to restart very frequently.

This is really my first experience with RedHat, as I have been a user of FreeBSD for over 10 years. I can never remember a single crash of Xvfb, since it became available on the systems running FreeBSD. I really would like to see a fix to this problem ASAP.

Jim

Comment 8 daryl herzmann 2009-07-01 14:01:13 UTC
Hi Jim,

I've been using Xvfb for many, many moons and never ran into trouble until now.  Will have to see how RHEL5.4 beta's xvfb behaves.  

Thankfully, I don't task xvfb enough to make it crash.  Are you sure your crashes are not related to memory exhaustion?

daryl

Comment 9 Jim 2009-07-01 14:23:58 UTC
Daryl,

I'm not sure about the memory problem, I'll have to let Brendon check into that next week, when he is back from vacation. However, yesterday for several hours, I pointed ALL of our graphics generating routines that use Xvfb to use another FreeBSD machine's Xvfb as a remote DISPLAY device (I can easily do that by changing a one line file, which all of our graphics generating programs access to see which display to use). During several hours of this experiment, the result was that Xvfb was still crashing on the RH box and still was being restarted at least every 5-15 minutes even though no activity was being sent its way. Xvfb was stable with no crashes on the FreeBSD box--in fact we don't even have an automatic check and restart script on it.

Xvfb is extremely important for our operations and research.

Jim

Comment 10 daryl herzmann 2009-08-05 16:54:09 UTC
Greetings RedHat,

Is there any more information I could provide you folks?  In the past 30 days, my Xvfb binary leaked just about 3 GB of memory.  I don't have issues with it crashing like my colleagues do.  Perhaps if I reached memory exhaustion, it would crash...

thanks,
  daryl

Comment 11 ritz 2009-08-06 06:44:09 UTC
Hi Daryl

RHEL get bugs get addressed a lot faster if they are submitted via customer support/tam via issue tracker. 

There are times when I've seen bugs submitted by BZ on RHEL problems that wind up hanging in limbo because there isn't an issue tracker ticket associated with it.

Having two tools can be a problem because support uses IT,  engineering uses BZ and product management makes their decisions using both.

Comment 12 daryl herzmann 2009-08-06 09:33:31 UTC
Hi Ritz,

Thanks for the message.  We are just a EDU customer with a cheap site subscription without support (other than for the rhn proxy machine).  No TAM either :) 

daryl

Comment 13 daryl herzmann 2009-09-03 22:10:22 UTC
Howdy,

The RHEL5.4 Xvfb leaks in the same manner :)  

xorg-x11-server-Xvfb-1.1.1-48.67.el5

daryl

Comment 14 daryl herzmann 2010-03-31 20:56:26 UTC
Howdy,

The RHEL5.5 Xvfb leaks in the same manner :)

xorg-x11-server-Xvfb-1.1.1-48.76.el5

daryl

Comment 15 daryl herzmann 2011-03-18 20:44:58 UTC
RHEL 6 Xvfb leaks as well :(

Comment 16 daryl herzmann 2011-06-06 16:05:27 UTC
RHEL 6.1 Xvfb leaks as well :(

Comment 17 linferna 2011-07-08 01:46:19 UTC
My workaround for the xvfb memory leak/crash to restart xvfb daily via a cronjob. Hope we will see a resolution to xvfb mem leak in rhel 5u7.

Comment 20 daryl herzmann 2011-08-08 17:42:53 UTC
sorry @linferna , RHEL 5.7 Xvfb leaks as well :(

Comment 22 daryl herzmann 2011-12-07 13:55:32 UTC
RHEL 6.2 Xvfb leaks as well :(

Comment 25 daryl herzmann 2012-01-30 01:14:32 UTC
Created attachment 558246 [details]
rhel6.2 valgrind output

More valgrind output for RHEL6.2 attached.  Just ran for about 20 minutes with the command:

valgrind --log-file=/tmp/myvg.log --tool=memcheck --leak-check=full --show-reachable=yes Xvfb :1 -screen 0 1280x1024x24

Comment 27 Adam Jackson 2012-02-24 16:30:10 UTC
So X has this silly notion of a "server regeneration", which is a bunch of teardown-and-reset that happens on the transition from N>1 clients to 0.  It looks like most of the leaked memory there is coming from the regeneration path.

As a (bad) workaround you could run Xvfb with -noreset, which will skip the regeneration code and just sit idle when the last client disconnects.  Technically that violates the letter of the X protocol spec but it's doubtful that your application is going to notice.

Comment 28 daryl herzmann 2012-02-24 18:32:20 UTC
Thank you.  I have been running the '-noreset' since your message and it appears to be working!  Have not seen any of the applications complain either.

Comment 29 daryl herzmann 2012-02-25 22:11:21 UTC
It is definitely working! Running for over a day now and near no change in memory, yipeee!  Thank you very much.

Comment 30 Peter Hutterer 2012-02-29 04:45:35 UTC
Some suggested patches for this issue:
http://lists.freedesktop.org/archives/xorg-devel/2012-February/029524.html

Comment 35 Adam Jackson 2012-07-24 19:47:38 UTC
Backported the applicable leak fixes from the upstream patch series in comment #30.

MODIFIED

Comment 37 Michael Boisvert 2012-09-19 15:54:41 UTC
Memory leak is still visible with the most updated packages when running:

# Xvfb :1 -screen 0 800x600x24 &
# while true; do xdpyinfo -display :1 ; done

Monitor using "top" in another terminal session and Xvfb constantly increases memory usage.

pmap results: 49304k to 89356k in 2560 iterations of xdpyinfo.

I will attach the pmap log.

Comment 38 Michael Boisvert 2012-09-19 15:55:20 UTC
Created attachment 614436 [details]
pmap log

Comment 39 Michael Boisvert 2012-10-17 18:47:26 UTC
Re-tested (using method in comment 37) with xorg-x11-server-1.1.1-48.97.el5 and associated:

49308K to 133116K in ~2hr and 40mins. The leak has slowed down, but is still evident. Is this acceptable?

Comment 40 Vladimir Benes 2012-10-18 07:58:59 UTC
(In reply to comment #39)
> Re-tested (using method in comment 37) with xorg-x11-server-1.1.1-48.97.el5
> and associated:
> 
> 49308K to 133116K in ~2hr and 40mins. The leak has slowed down, but is still
> evident. Is this acceptable?

no, this is unacceptable. Imagine that it needs to run for days.
-> ASSIGNED

Comment 41 Adam Jackson 2012-10-23 17:43:36 UTC
Yet another hole plugged, MODIFIED again.

Comment 43 Michael Boisvert 2012-10-23 19:54:50 UTC
New packages fixed the memory leak entirely. Locked at 49276K, I will be running it over night but for now, Verified.

Comment 45 errata-xmlrpc 2013-01-08 07:39:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0083.html


Note You need to log in before you can comment on or make changes to this bug.