Bug 873537

Summary: virsh save will crash libvirtd sometimes
Product: Red Hat Enterprise Linux 6 Reporter: zhpeng
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, cwei, dallan, dyasny, dyuan, mzhan, pkrempa, ydu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-8.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:11:33 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:
Attachments:
Description Flags
libvirtd log
none
guest xml none

Description zhpeng 2012-11-06 06:37:25 UTC
Description of problem:
virsh save will crash libvirtd sometimes

Version
libvirt-0.10.2-7.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.330.el6.x86_64

How reproducible:
20%


Steps to Reproduce:
# for i in {1..100}; do virsh save rail /tmp/rail.save; virsh restore /tmp/rail.save; done

Domain rail saved to /tmp/rail.save

Domain restored from /tmp/rail.save


Domain rail saved to /tmp/rail.save

Domain restored from /tmp/rail.save


Domain rail saved to /tmp/rail.save

Domain restored from /tmp/rail.save


Domain rail saved to /tmp/rail.save

Domain restored from /tmp/rail.save

error: Failed to save domain rail to /tmp/rail.save
error: End of file while reading data: Input/output error
error: Failed to reconnect to the hypervisor

error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused


Actual results:
libvirtd crashed.

Expected results:
no crash.

Additional info:

Comment 1 zhpeng 2012-11-06 06:37:57 UTC
Created attachment 639136 [details]
libvirtd log

Comment 2 zhpeng 2012-11-06 06:38:17 UTC
Created attachment 639137 [details]
guest xml

Comment 4 Peter Krempa 2012-11-06 10:17:01 UTC
Fix sent upstream:
https://www.redhat.com/archives/libvir-list/2012-November/msg00277.html

Comment 7 Peter Krempa 2012-11-06 14:00:59 UTC
Fixed upstream:

commit fb58f8e2a4c4ab619eab3860b263110a5bd9010f
Author: Peter Krempa <pkrempa>
Date:   Tue Nov 6 10:55:26 2012 +0100

    qemu: Don't corrupt pointer in qemuDomainSaveMemory()
    
    The code that was split out into the qemuDomainSaveMemory expands the
    pointer containing the XML description of the domain that it gets from
    higher layers. If the pointer changes the old one is invalid and the
    upper layer function tries to free it causing an abort.
    
    This patch changes the expansion of the original string to a new
    allocation and copy of the contents.

Comment 10 zhpeng 2012-11-15 03:08:48 UTC
It's verified with:

libvirt-0.10.2-8.el6.x86_64

steps is:


for i in {1..100}; do virsh save aaa /tmp/aaa.save; virsh restore /tmp/aaa.save; done

Comment 11 errata-xmlrpc 2013-02-21 07:11:33 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/RHSA-2013-0276.html