RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 726020 - Fix memleaks in all virtio devices
Summary: Fix memleaks in all virtio devices
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Amit Shah
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-27 10:31 UTC by Amit Shah
Modified: 2013-01-10 00:09 UTC (History)
5 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.179.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 15:54:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:1531 0 normal SHIPPED_LIVE Moderate: qemu-kvm security, bug fix, and enhancement update 2011-12-06 01:23:30 UTC

Description Amit Shah 2011-07-27 10:31:11 UTC
Description of problem:

virtio_cleanup() is supposed to reverse the mallocs in virtio_common_init().  However, it doesn't free up RAM allocated for device structures (VirtIOBlock, VirtIOBalloon, VirtIOSerial, VirtIONet) which embed the VirtIODevice struct.

This means all the virtio devices leak memory on unplug or qemu exit.

Comment 7 Shaolong Hu 2011-09-09 10:16:03 UTC
Since there is also memory leak in virtio-blk and virtio-balloon which is fixed on qemu-kvm-0.12.1.2-2.179.el6, choose virtio-net to verify this bug.


Steps to reproduce and verify:
------------------------------------
1.Disable as more services as possible in level 3 and init 3:
[root@localhost ~]# ls /etc/rc.d/rc3.d/
K01libvirt-guests  K05atd        K30postfix         K50snmpd       K74acpid      K75quota_nld  K83rpcidmapd       K85messagebus   K88iscsi    K92ip6tables     S05cgconfig
K01smartd          K10psacct     K30spice-vdagentd  K50snmptrapd   K74haldaemon  K75udev-post  K84NetworkManager  K86cgred        K88rsyslog  K92iptables      S13rpcbind
K02avahi-daemon    K10saslauthd  K46radvd           K60crond       K74ntpd       K80kdump      K84wpa_supplicant  K87irqbalance   K89iscsid   K99cpuspeed      S84ksm
K02rhsmcertd       K16abrtd      K50dnsmasq         K60nfs         K75netfs      K83nfslock    K85ebtables        K87restorecond  K89rdisc    K99lvm2-monitor  S85ksmtuned
K03rhnsd           K25sshd       K50netconsole      K69rpcsvcgssd  K75ntpdate    K83rpcgssd    K85mdmonitor       K88auditd       K90network  K99sysstat       S99local

2.Make sure top suggests there are not other memory consuming processes:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+ COMMAND            
    1 root      20   0 19204 1492 1208 S  0.0  0.0   0:00.62 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.01 migration/0
    4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0

3.Boot guest, do 300 times virtio-net-pci device hotplug/unplug, use "free -m" when:
  1) before start qemu
  2) before hotplug/unplug
  3) after hotplug/unplug
  4) after exit qemu
  each time before "free -m", do "echo 3 > /proc/sys/vm/drop_caches" first.


Actual results:
---------------------
reproduced on qemu-kvm-0.12.1.2-2.178.el6.x86_64:

used    free    buffers/cached             
183     7279          0/7             <---before start qemu
746     6716          0/9             <---start qemu
761     6701          0/9             <---after hotplug/unplug 300 times
183     7278          0/7             <---after exit qemu

verified on qemu-kvm-0.12.1.2-2.184.el6.x86_64:

used    free    buffers/cached             
182     7279          0/6             <---before start qemu
753     6709          0/9             <---start qemu
758     6704          0/9             <---after hotplug/unplug 300 times
183     7279          0/6             <---after exit qemu

Conclusion:
---------------
After hotplug/unplug 300 times, but not exit yet, on qemu-kvm 178, system free memory reduces 15M, on 184, reduces only 5M, based on results above, the patch works well, verified.

Comment 9 errata-xmlrpc 2011-12-06 15:54:53 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-2011-1531.html


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