Bug 745761

Summary: screenshot leaks pipe fd
Product: [Community] Virtualization Tools Reporter: Marc-Andre Lureau <marcandre.lureau>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, eblake, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 746075 (view as bug list) Environment:
Last Closed: 2011-10-13 20:13:06 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: 746075    

Description Marc-Andre Lureau 2011-10-13 10:30:36 UTC
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.

Comment 1 Marc-Andre Lureau 2011-10-13 11:24:04 UTC
It seems *errfd = pipeerr[0]; in command.c is not closed.

Comment 2 Marc-Andre Lureau 2011-10-13 11:45:16 UTC
I'll send a patch to libvirt ML.

Comment 3 Eric Blake 2011-10-13 20:13:06 UTC
0.9.7 will include:

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