Bug 172708

Summary: [RHEL4] X doesn't clean up all cursors after calling XFreeCursor
Product: Red Hat Enterprise Linux 4 Reporter: Bastien Nocera <bnocera>
Component: xorg-x11Assignee: X/OpenGL Maintenance List <xgl-maint>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: ivazqueznet, keithp, mclasen, rstrode
Target Milestone: ---Keywords: Desktop
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2006-0412 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-08-10 21:44:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 181409    
Attachments:
Description Flags
set the cursor several times a second
none
set the cursor using xlib
none
compile with gcc frob-x-cursor.c -L/usr/X11R6/lib -lX11 -lXRest -o frob-x-cursor
none
compile with gcc frob-x-cursor.c -o frob-x-cursor -L/usr/X11R6/lib -lX11 -lXRes -DN_RUNS=1000 none

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