Red Hat Bugzilla – Bug 1325043
libvirt forget free priv->machineName when clear guest resource
Last modified: 2016-11-03 14:41:23 EDT
Description of problem: libvirt forget free priv->machineName when clear guest resource Version-Release number of selected component (if applicable): libvirt-1.3.3-1.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. setup valgrind # valgrind --leak-check=full libvirtd 2. start guest but fail: # virsh start rhel7.0-rhel error: Failed to start domain rhel7.0-rhel error: internal error: process exited while connecting to monitor: 2016-04-08T03:30:30.832952Z qemu-kvm: -object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,size=1053818880: memory size 0x3ed00000 must be equal to or larger than huge page size 0x40000000 3. valgrind info ==31007== 3,300 bytes in 3 blocks are definitely lost in loss record 690 of 704 ==31007== at 0x4C29BFD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==31007== by 0x4C2BACB: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==31007== by 0x54ABDBF: virReallocN (viralloc.c:245) ==31007== by 0x54AE993: virBufferGrow (virbuffer.c:130) ==31007== by 0x54AEE4A: virBufferVasprintf (virbuffer.c:388) ==31007== by 0x54AEFD3: virBufferAsprintf (virbuffer.c:361) ==31007== by 0x550FAE3: virSystemdMakeMachineName (virsystemd.c:161) ==31007== by 0x1E646623: qemuInitCgroup (qemu_cgroup.c:822) ==31007== by 0x1E646623: qemuSetupCgroup (qemu_cgroup.c:979) ==31007== by 0x1E65EA31: qemuProcessLaunch (qemu_process.c:5311) ==31007== by 0x1E6627C1: qemuProcessStart (qemu_process.c:5570) ==31007== by 0x1E6BF147: qemuDomainObjStart.constprop.47 (qemu_driver.c:7195) ==31007== by 0x1E6BF885: qemuDomainCreateWithFlags (qemu_driver.c:7249) Actual results: memleak on priv->machineName Expected results: no memleak Additional info:
Fixed upstream with v1.3.3-53-g16b41728b59a: commit 16b41728b59a7188f643937303e3aec4c299a980 Author: Martin Kletzander <mkletzan@redhat.com> Date: Fri Apr 8 15:29:40 2016 +0200 qemu: Free priv->machineName
Verify this bug with libvirt-2.0.0-4.el7.x86_64: 1. setup valgrind # valgrind --leak-check=full libvirtd 2. start guest but fail: # virsh start r7 error: Failed to start domain r7 error: internal error: process exited while connecting to monitor: 2016-08-09T08:37:15.133793Z qemu-kvm: -object memory-backend-file,id=ram-node1,prealloc=yes,mem-path=/dev/hugepages1G/libvirt/qemu,size=536870912,host-nodes=0-1,policy=bind: memory size 0x20000000 must be equal to or larger than page size 0x40000000 3. check valgrind report, although there is another memory leak in this report, it will be another problem ^C==4306== ==4306== HEAP SUMMARY: ==4306== in use at exit: 522,939 bytes in 6,202 blocks ==4306== total heap usage: 116,468 allocs, 110,266 frees, 180,424,060 bytes allocated ==4306== ==4306== 48 bytes in 1 blocks are definitely lost in loss record 420 of 642 ==4306== at 0x4C29975: calloc (vg_replace_malloc.c:711) ==4306== by 0x54B118C: virAllocN (viralloc.c:191) ==4306== by 0x552E12A: virDomainUSBAddressHubNew (domain_addr.c:1384) ==4306== by 0x5530C34: virDomainUSBAddressSetAddController (domain_addr.c:1422) ==4306== by 0x5530C34: virDomainUSBAddressSetAddControllers (domain_addr.c:1547) ==4306== by 0x21FFCE39: qemuDomainAssignUSBAddresses (qemu_domain_address.c:1741) ==4306== by 0x21FFCE39: qemuDomainAssignAddresses (qemu_domain_address.c:1791) ==4306== by 0x22012FA5: qemuProcessPrepareDomain (qemu_process.c:4885) ==4306== by 0x2201A2DF: qemuProcessStart (qemu_process.c:5460) ==4306== by 0x220761E7: qemuDomainObjStart.constprop.48 (qemu_driver.c:7059) ==4306== by 0x22076925: qemuDomainCreateWithFlags (qemu_driver.c:7113) ==4306== by 0x55C3E3B: virDomainCreate (libvirt-domain.c:6787) ==4306== by 0x14AF7A: remoteDispatchDomainCreate (remote_dispatch.h:4116) ==4306== by 0x14AF7A: remoteDispatchDomainCreateHelper (remote_dispatch.h:4092) ==4306== by 0x562F931: virNetServerProgramDispatchCall (virnetserverprogram.c:437) ==4306== by 0x562F931: virNetServerProgramDispatch (virnetserverprogram.c:307) ==4306== ==4306== LEAK SUMMARY: ==4306== definitely lost: 48 bytes in 1 blocks ==4306== indirectly lost: 0 bytes in 0 blocks ==4306== possibly lost: 0 bytes in 0 blocks ==4306== still reachable: 522,891 bytes in 6,201 blocks ==4306== suppressed: 0 bytes in 0 blocks ==4306== Reachable blocks (those to which a pointer was found) are not shown. ==4306== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==4306== ==4306== For counts of detected and suppressed errors, rerun with: -v ==4306== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
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-2016-2577.html