RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 746075 - screenshot leaks pipe fd
Summary: screenshot leaks pipe fd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 745761
Blocks: 748554
TreeView+ depends on / blocked
 
Reported: 2011-10-13 20:05 UTC by Eric Blake
Modified: 2011-12-06 11:37 UTC (History)
11 users (show)

Fixed In Version: libvirt-0.9.4-18.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 745761
Environment:
Last Closed: 2011-12-06 11:37:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Eric Blake 2011-10-13 20:05:52 UTC
Cloning to RHEL.

+++ This bug was initially created as a clone of Bug #745761 +++

Description of problem:

It seems the screenshot API leaks FDs.

Version-Release number of selected component (if applicable):

v0.9.6-139-g9bc9999 (current git master)

How reproducible:

10/10

Steps to Reproduce:
1. lsof -p `pidof libvirtd`
2. virsh screenshot a-running-vm
3. lsof -p `pidof libvirtd`
  
Actual results:

The number of open files grows, and a new pipe fd is leaked.

Expected results:

The number of open files should remain constant after taking screenshots.

--- Additional comment from marcandre.lureau on 2011-10-13 05:24:04 MDT ---

It seems *errfd = pipeerr[0]; in command.c is not closed.

--- Additional comment from marcandre.lureau on 2011-10-13 05:45:16 MDT ---

I'll send a patch to libvirt ML.

Comment 1 Eric Blake 2011-10-13 20:07:46 UTC
Needs at least these two upstream commits:

commit 72851bb9ef0a6aef20141d0a13c36e5a1907a43a
Author: Marc-André Lureau <marcandre.lureau>
Date:   Thu Oct 13 13:47:58 2011 +0200

    virFDStream: close also given errfd (fd leak)
    
    In virFDStreamOpenFileInternal(), a errfd pipe is opened by
    virCommandRunAsync() and given to virFDStreamOpenInternal().
    
    It seems virFDStream should close errfd, just like the other
    fd it is given.
    
    This fixes screenshots leaking FDs:
    http://bugzilla.redhat.com/show_bug.cgi?id=745761

commit be5ec76630c4af83404e8fbf2b5a6b7cb46656e7
Author: Marc-André Lureau <marcandre.lureau>
Date:   Sat Oct 1 03:39:14 2011 +0200

    Set to NULL members that have been freed to prevent crashes
    
    Do not crash if virStreamFinish is called after error.

Comment 6 yuping zhang 2011-10-18 06:12:22 UTC
Reproduce this issue on libvirt-0.9.4-16.el6.x86_64,after make screenshot for a running guest,there is one more open file:
libvirtd 8906 root   37r  FIFO                0,8      0t0  194216788 pipe

Verified this issue on:
libvirt-0.9.4-18.el6.x86_64
libvirt-client-0.9.4-18.el6.x86_64
libvirt-python-0.9.4-18.el6.x86_64

1. # lsof -p `pidof libvirtd` > 746075.1
2. # virsh screenshot rhel62
Screenshot saved to rhel62-2011-10-19-04:18:42.ppm, with type of image/x-portable-pixmap
3. # lsof -p `pidof libvirtd` >746072.2
4. # vimdiff 746075.1 746075.2

The two files are same.
So change the bug status to VERIFIED.

Comment 7 errata-xmlrpc 2011-12-06 11:37:24 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-2011-1513.html


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