Bug 1072677

Summary: Incorrect error message when hot-plugging interface with an inexistence nwfilter
Product: Red Hat Enterprise Linux 7 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: dyuan, honzhang, lhuang, mprivozn, mzhan, rbalakri, stefanb, ydu
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.7-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:31:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hu Jianwei 2014-03-05 02:46:37 UTC
Description of problem:
Incorrect error message when hot-plugging interface with an inexistence nwfilter.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-25.el7.x86_64
qemu-kvm-rhev-1.5.3-50.el7.x86_64
kernel-3.10.0-97.el7.x86_64

How reproducible:
50%(probability issue)

Steps to Reproduce:
1. Hot-plug one interface with inexistence nwfiter(maybe you need attach it several times to reproduce it.)

[root@intel-e5530-8-2 ~]# cat interface.xml
   <interface type='network'>
      <source network='default'/>
      <filterref filter='my1'>
      </filterref>
    </interface>

[root@intel-e5530-8-2 ~]# virsh attach-device r7 interface.xml 
error: Failed to attach device from interface.xml
error: Network filter not found: Could not find filter 'my1'
.
.
.
[root@intel-e5530-8-2 ~]# virsh attach-device r7 interface.xml
error: Failed to attach device from interface.xml
error: End of file while reading data: Input/output error
error: One or more references were leaked after disconnect from the hypervisor
error: Reconnected to the hypervisor

2. Check the libvirtd status(libvirtd is living, not restart or stop)
[root@intel-e5530-8-2 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 35    r7                             running

Actual results:
As shown above.

Expected results:
I think libvirt should print proper message to foreground. Just like the first error message above "Network filter not found: Could not find filter 'my1'"

Comment 1 Stefan Berger 2014-03-08 19:26:59 UTC
I am seeing this error in the log the 2nd time I try to attach the interface:

2014-03-08 19:07:24.605+0000: 549: warning : virFileClose:83 : Tried to close invalid fd 0

I see it internally visiting the error message above also the 2nd time it runs. After that we then run into the following error:

[Switching to Thread 0x7f59b28cd840 (LWP 3084)]

Breakpoint 1, virFileClose (fdptr=fdptr@entry=0x7fa5d00e6318, 
    flags=flags@entry=VIR_FILE_CLOSE_PRESERVE_ERRNO) at util/virfile.c:82
82	                if (!(flags & VIR_FILE_CLOSE_IGNORE_EBADF))
(gdb) bt
#0  virFileClose (fdptr=fdptr@entry=0x7fa5d00e6318, 
    flags=flags@entry=VIR_FILE_CLOSE_PRESERVE_ERRNO) at util/virfile.c:82
#1  0x00007fa5ce779252 in virNetSocketDispose (obj=0x7fa5d00e62e0)
    at rpc/virnetsocket.c:1049
#2  0x00007fa5ce64f45b in virObjectUnref (anyobj=<optimized out>)
    at util/virobject.c:262
#3  0x00007fa5ce62dbaa in virEventPollCleanupHandles ()
    at util/vireventpoll.c:583
#4  0x00007fa5ce62ea03 in virEventPollRunOnce () at util/vireventpoll.c:619
#5  0x00007fa5ce62d64b in virEventRunDefaultImpl () at util/virevent.c:306
#6  0x00007fa5ce76e70d in virNetServerRun (srv=srv@entry=0x7fa5d00d8920)
    at rpc/virnetserver.c:1117
#7  0x00007fa5cf1b3918 in main (argc=<optimized out>, argv=<optimized out>)
    at libvirtd.c:1526

Comment 2 Stefan Berger 2014-03-08 23:14:51 UTC
The problem is due to the freeing of the zero file descriptor. Patch on the way.

Comment 3 Michal Privoznik 2014-03-11 09:33:54 UTC
The patch has been pushed to upstream repo:

commit 6768b210335e9c0c7d97bb96ad2ff69a276236a3
Author:     Stefan Berger <stefanb.ibm.com>
AuthorDate: Mon Mar 10 18:47:19 2014 -0400
Commit:     Stefan Berger <stefanb.com>
CommitDate: Mon Mar 10 18:47:19 2014 -0400

    BZ1072677: Avoid freeing of 0 file descriptor
    
    Avoid the freeing of an array of zero file descriptors in case
    of error. Initialize the array to -1 using memset.
    
    Signed-off-by: Stefan Berger <stefanb.ibm.com>

v1.2.2-76-g6768b21

Comment 4 Michal Privoznik 2014-07-08 16:33:56 UTC
Moving to POST per comment 3.

Comment 5 Ján Tomko 2014-07-23 12:25:29 UTC
*** Bug 1122337 has been marked as a duplicate of this bug. ***

Comment 7 Hu Jianwei 2014-11-24 10:16:03 UTC
Verified as below:

[root@ibm-x3850x5-06 ~]# rpm -q libvirt
libvirt-1.2.8-7.el7.x86_64

[root@ibm-x3850x5-06 ~]# cat interface.xml 
   <interface type='network'>
      <source network='default'/>
      <filterref filter='my1'>
      </filterref>
    </interface>
[root@ibm-x3850x5-06 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 17    r7                             running

[root@ibm-x3850x5-06 ~]# virsh attach-device r7 interface.xml 
error: Failed to attach device from interface.xml
error: Network filter not found: Could not find filter 'my1'

[root@ibm-x3850x5-06 ~]# virsh attach-device r7 interface.xml 
error: Failed to attach device from interface.xml
error: Network filter not found: Could not find filter 'my1'

After repeating vish cmd more than 10 times:

[root@ibm-x3850x5-06 ~]# virsh attach-device r7 interface.xml 
error: Failed to attach device from interface.xml
error: Network filter not found: Could not find filter 'my1'



libvirt always report a consistent error message, move to Verified.

Comment 9 errata-xmlrpc 2015-03-05 07:31:07 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.

https://rhn.redhat.com/errata/RHSA-2015-0323.html