Bug 172708 - [RHEL4] X doesn't clean up all cursors after calling XFreeCursor
Summary: [RHEL4] X doesn't clean up all cursors after calling XFreeCursor
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: xorg-x11
Version: 4.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: X/OpenGL Maintenance List
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 181409
TreeView+ depends on / blocked
 
Reported: 2005-11-08 16:27 UTC by Bastien Nocera
Modified: 2007-11-30 22:07 UTC (History)
4 users (show)

Fixed In Version: RHBA-2006-0412
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-08-10 21:44:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
set the cursor several times a second (545 bytes, text/plain)
2005-11-09 01:02 UTC, Ray Strode [halfline]
no flags Details
set the cursor using xlib (406 bytes, text/plain)
2005-11-09 14:48 UTC, Matthias Clasen
no flags Details
compile with gcc frob-x-cursor.c -L/usr/X11R6/lib -lX11 -lXRest -o frob-x-cursor (1.73 KB, text/x-csrc)
2005-11-09 17:57 UTC, Ray Strode [halfline]
no flags Details
compile with gcc frob-x-cursor.c -o frob-x-cursor -L/usr/X11R6/lib -lX11 -lXRes -DN_RUNS=1000 (2.03 KB, text/x-csrc)
2005-11-09 18:25 UTC, Ray Strode [halfline]
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2006:0412 0 normal SHIPPED_LIVE xorg-x11 bug fix update 2006-08-09 04:00:00 UTC

Description Bastien Nocera 2005-11-08 16:27:02 UTC
gpdf 2.8.2-4.4

Reproducer:
- Check the memory used by your X server
- Open a bigger pdf in gpdf (> 3 megs) with lots pages[1]
- Press "Page down" keyboard button and keep it pressed until you reach the end
of the document.
- Press "Page up" until you reach the top.
- Repeat several times
- Close gpdf
- Check the memory used by your X server, it should have increased by a couple
of megabytes (depending how many times you browsed through the file)

I have also tested with the upstream gpdf 2.8.3 without reproducing the problem,
and our 2.8.2-4.4 package without gpdf-2.8.2-CAN-2005-2097.patch without
reproducing the problem.

[1]:
http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/pdf/rhl-ig-x86-en-9.pdf
for example

Comment 1 Ray Strode [halfline] 2005-11-09 01:02:12 UTC
Created attachment 120830 [details]
set the cursor several times a second

Hi,

This looks like it might actually be a gtk+ or X bug. I think a cursor is being
leaked every time gpdf changes to its busy cursor (which happens a lot of times
when loading a document and then each time you press page down or page up).

It's fairly easily reproducible with a small test program like the one attached
above.

xrestop --batch | grep -A 15 foo

shows the number of cursors on the X server increasing.

Comment 3 Matthias Clasen 2005-11-09 14:46:38 UTC
X problem, I'd say. Here is a pure Xlib program which shows the same behaviour.

Comment 4 Matthias Clasen 2005-11-09 14:48:01 UTC
Created attachment 120841 [details]
set the cursor using xlib

Comment 5 Ray Strode [halfline] 2005-11-09 17:55:40 UTC
Yea, this definitely looks like an X bug.  I'll attach a test case that returns
0 if it doesn't leak, and the number of leaked cursors when it does leak.

Comment 6 Ray Strode [halfline] 2005-11-09 17:57:10 UTC
Created attachment 120848 [details]
compile with gcc frob-x-cursor.c -L/usr/X11R6/lib -lX11 -lXRest  -o frob-x-cursor

Comment 7 Ray Strode [halfline] 2005-11-09 18:25:37 UTC
Created attachment 120849 [details]
compile with gcc frob-x-cursor.c -o frob-x-cursor -L/usr/X11R6/lib -lX11 -lXRes -DN_RUNS=1000

Matthias pointed out that the test case may be less than convincing because
it's reasonable for the X server to cache common cursors.  To show this isn't
happening, I've modified the test case to loop 1000 times and return the
average number of leaked cursors per iteration.

Comment 8 Ray Strode [halfline] 2005-11-10 15:59:31 UTC
A couple more notes...

With the Bluecurve cursor theme, the busy cursor (which is animated) seems to
leak 12 cursors, but the arrow (which is not animated) seems to not leak any.

If I delete my cursor themes then the default non-animated watch busy cusor
doesn't leak.

So, to me, it looks like it doesn't clean up all frames on animated cursors.

Comment 11 Mike A. Harris 2006-03-28 18:02:14 UTC
Patch xorg-x11-6.8.2-xcursor-memleak-fix.patch added to test candidate for U4.

Please test the xorg-x11-6.8.2-1.EL.13.26 packages available for download via
FTP at:  ftp://people.redhat.com/mharris/testing/4E/xorg-x11


Comment 13 Bastien Nocera 2006-03-30 09:20:43 UTC
Packages tested successfully, thanks.

Comment 17 Mike A. Harris 2006-04-25 14:20:27 UTC
Setting to MODIFIED state.

Comment 20 Red Hat Bugzilla 2006-08-10 21:44:40 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0412.html



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