Bug 798497

Summary: Plug memory leak on migration
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, dallan, dyuan, mzhan, rwu, weizhan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-6.el6 Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:49:18 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:

Description Alex Jia 2012-02-29 03:37:52 UTC
Description of problem:
Plug memory leak on migration.

Version-Release number of selected component (if applicable):
# rpm -q libvirt
libvirt-0.9.10-3.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. configure migration environment
2. virsh start <domain>
3. valgrind -v --leak-check=full virsh migrate <domain> qemu+ssh://<target ip>/system --unsafe
  
Actual results:

==30879== 8 bytes in 1 blocks are definitely lost in loss record 1 of 30
==30879==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==30879==    by 0x39CF115FB8: xdr_reference (in /lib64/libc-2.12.so)
==30879==    by 0x39CF115F10: xdr_pointer (in /lib64/libc-2.12.so)
==30879==    by 0x4D52614: xdr_remote_string (remote_protocol.c:40)
==30879==    by 0x4D52680: xdr_remote_domain_migrate_prepare3_ret (remote_protocol.c:4772)
==30879==    by 0x4D6F742: virNetMessageDecodePayload (virnetmessage.c:382)
==30879==    by 0x4D5BCDF: virNetClientProgramCall (virnetclientprogram.c:382)
==30879==    by 0x4D384EB: callWithFD (remote_driver.c:4547)
==30879==    by 0x4D3858B: call (remote_driver.c:4568)
==30879==    by 0x4D44F34: remoteDomainMigratePrepare3 (remote_driver.c:4136)
==30879==    by 0x4D27240: virDomainMigrateVersion3 (libvirt.c:4809)
==30879==    by 0x4D28A6C: virDomainMigrate2 (libvirt.c:5448)
==30879==
==30879== LEAK SUMMARY:
==30879==    definitely lost: 8 bytes in 1 blocks

Expected results:
avoid memory leak.

Additional info:

Comment 1 Dave Allan 2012-02-29 22:13:54 UTC
Alex, do you have a patch for this one?

Comment 2 Alex Jia 2012-03-01 02:23:06 UTC
(In reply to comment #1)
> Alex, do you have a patch for this one?

Hello Dave,
I'm trying to find a right place to fix the leak firstly.

Regards,
Alex

Comment 5 Osier Yang 2012-03-16 11:07:32 UTC
patch posted internally, move to POST.

http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-March/msg01476.html

Comment 6 Dave Allan 2012-03-16 13:27:54 UTC
Osier, can you describe the leak?  Is the leak in virsh or the daemon or both, and what action by the user causes the leak to occur?  Is it an error path or a normal use case?

Comment 7 Osier Yang 2012-03-16 13:34:42 UTC
(In reply to comment #6)
> Osier, can you describe the leak?  Is the leak in virsh or the daemon or both,
> and what action by the user causes the leak to occur?  Is it an error path or a
> normal use case?

It's leak in remote driver, so each libvirt client will leak, no leak in daemon.

It's not a error path, just a normal use case will cause that.

Comment 8 Dave Allan 2012-03-16 13:44:49 UTC
Ok, given that, we need to fix this in 6.3.

Comment 9 Osier Yang 2012-03-16 13:56:26 UTC
(In reply to comment #8)
> Ok, given that, we need to fix this in 6.3.

Yes, it's leak after every migration operation.

Comment 12 weizhang 2012-03-19 10:38:48 UTC
Verify pass on
libvirt-0.9.10-6.el6.x86_64
qemu-kvm-0.12.1.2-2.246.el6.x86_64
kernel-2.6.32-250.el6.x86_64

Start a guest without cache=none for its disk
No memory leak after migration with --unsafe
==17411== LEAK SUMMARY:
==17411==    definitely lost: 0 bytes in 0 blocks

Comment 13 Osier Yang 2012-05-04 07:10:29 UTC
    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 15 errata-xmlrpc 2012-06-20 06:49:18 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-2012-0748.html