Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 766308 - libvirtd does not close all fds opened by virt-install
libvirtd does not close all fds opened by virt-install
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.2
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-11 10:08 EST by Sadique Puthen
Modified: 2012-06-20 02:38 EDT (History)
7 users (show)

See Also:
Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 02:38:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
before installation (9.15 KB, text/plain)
2011-12-14 01:33 EST, zhpeng
no flags Details
installation (11.29 KB, text/plain)
2011-12-14 01:34 EST, zhpeng
no flags Details
after installation (9.61 KB, text/plain)
2011-12-14 01:35 EST, zhpeng
no flags Details
after restart libvirtd (9.26 KB, text/plain)
2011-12-14 01:36 EST, zhpeng
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 15:31:38 EDT

  None (edit)
Description Sadique Puthen 2011-12-11 10:08:16 EST
Description of problem:

libvirtd does not close all fds opened to install guests by virt-install after virt-install finished installing the guest.
 
Version-Release number of selected component (if applicable):

libvirt-0.9.4-12.el6.x86_64

How reproducible:

Always.

Steps to Reproduce:

Fds opened by libvirted before starting installation:

# lsof | grep libvirt | wc
    102     922   10980

During installation.

# lsof | grep libvirt | wc 
    117    1067   12790

Installation is done using the below command.

# virt-install -r 1000 -n sadique-test5 --disk path=/home/images/sadique-test5.img,format=raw,bus=virtio,size=10 --network bridge=br1,model=virtio --os-type=linux --os-variant=rhel6 --vcpus=2,maxvcpus=4 --cdrom=/tmp/rhel-server-5.4-x86_64-dvd.iso

After the installation. (we can see that 1 fd is not closed)

# lsof | grep libvirt | wc 
    103     933   11086

After restarting libvirtd immediately.

# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
[root@dhcp210-207 ~]# lsof | grep libvirt | wc 
    102     922   10980


I have done multiple installations to verify that the one extra fd is associated with virt-install and not by libvirtd for other purposes.
Comment 1 Dave Allan 2011-12-12 14:02:05 EST
(In reply to comment #0)
> I have done multiple installations to verify that the one extra fd is
> associated with virt-install and not by libvirtd for other purposes.

Can you track down the problem further?  Ideally, I would think that this is the kind of BZ for which SEG could submit a patch.  It looks like a simple resource leak.
Comment 2 Alex Jia 2011-12-13 23:59:57 EST
(In reply to comment #0)
> Description of problem:
> 
> libvirtd does not close all fds opened to install guests by virt-install after
> virt-install finished installing the guest.
> 
> Version-Release number of selected component (if applicable):
> 
> libvirt-0.9.4-12.el6.x86_64
> 
BTW, it's okay for libvirt-0.9.8-1.el6.x86_64, I haven't found fds leak after virt-install completing installation, so it should be also okay on upstream, although I can't confirm which commit fixed this issue.
Comment 3 zhpeng 2011-12-14 01:33:41 EST
Created attachment 546578 [details]
before installation
Comment 4 zhpeng 2011-12-14 01:34:26 EST
Created attachment 546579 [details]
installation
Comment 5 zhpeng 2011-12-14 01:35:11 EST
Created attachment 546580 [details]
after installation
Comment 6 zhpeng 2011-12-14 01:36:46 EST
Created attachment 546585 [details]
after restart libvirtd
Comment 7 zhpeng 2011-12-14 01:39:48 EST
I can reproduce this with libvirt-0.9.4-23.el6.x86_64.
And can't reproduce this with libvirt-0.9.8-1.el6.x86_64.

Updated 4 logs of comment 0 from "before installation" to "restart libvirtd" of comment 0.
Comment 8 Alex Jia 2011-12-14 03:58:21 EST
It seems some patch hasn't been backported into libvirt rpm package of RHEL:

commit 7ea2ef4ce82be9574b4e1fb2a90f2f2c8dc84172
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Jul 19 14:11:33 2011 +0100

    Use a virFreeCallback on virNetSocket to ensure safe release
    
    When unregistering an I/O callback from a virNetSocket object,
    there is still a chance that an event may come in on the callback.
    In this case it is possible that the virNetSocket might have been
    freed already. Make use of a virFreeCallback when registering
    the I/O callbacks and hold a reference for the entire time the
    callback is set.
    
    * src/rpc/virnetsocket.c: Register a free function for the
      file handle watch
    * src/rpc/virnetsocket.h, src/rpc/virnetserverservice.c,
      src/rpc/virnetserverclient.c, src/rpc/virnetclient.c: Add
      a free function for the socket I/O watches

If so, maybe, should open the bug in 6.2.z, then cherry-pick the patch.
Comment 9 Dave Allan 2012-01-04 15:36:37 EST
(In reply to comment #7)
> I can reproduce this with libvirt-0.9.4-23.el6.x86_64.
> And can't reproduce this with libvirt-0.9.8-1.el6.x86_64.
> 
> Updated 4 logs of comment 0 from "before installation" to "restart libvirtd" of
> comment 0.

Moving to POST
Comment 11 yanbing du 2012-01-10 05:54:38 EST
Test this bug with libvirt-0.9.9-1.el6.x86_64.
1. Before starting installation:
# lsof | grep libvirt | wc
    171    1542   17900
2. During installation:
# lsof | grep libvirt | wc
    185    1676   19793
3. After installation:
# lsof | grep libvirt | wc 
    171    1542   17900
All fds opened by virt-install are closed, so move bug to VERIFIED.
Comment 12 Peter Krempa 2012-05-02 05:44:37 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No Documentation needed
Comment 14 errata-xmlrpc 2012-06-20 02:38:29 EDT
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/RHSA-2012-0748.html

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