Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
Memleak when "run virsh console guest".
Version-Release number of selected component (if applicable):
libvirt-0.9.8-1.el6.x86_64
How reproducible:
always
Steps to Reproduce:
1. make sure have a working serial on guest like:
<serial type='pty'>
<source path='/dev/pts/12'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
2. add "console=tty0 console=ttyS0" to the kernel line of guest.
3. reboot the guest
4. valgrind -v --leak-check=full virsh console kvm1
5. login in the guest on step5 and do some operation.
6. leave the console with "Ctrl + ]"
Actual results:
==800== 1,024 bytes in 1 blocks are definitely lost in loss record 26 of 33
==800== at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==800== by 0x4A06167: realloc (vg_replace_malloc.c:525)
==800== by 0x4C6A6EB: virReallocN (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x40A867: ??? (in /usr/bin/virsh)
==800== by 0x4C62EDE: ??? (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x4C61C86: virEventRunDefaultImpl (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x41C031: ??? (in /usr/bin/virsh)
==800== by 0x4C73BD1: ??? (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x32E64077F0: start_thread (in /lib64/libpthread-2.12.so)
==800== by 0x32E5CE570C: clone (in /lib64/libc-2.12.so)
==800==
==800== 1,024 bytes in 1 blocks are definitely lost in loss record 27 of 33
==800== at 0x4A0610F: realloc (vg_replace_malloc.c:525)
==800== by 0x4C6A6EB: virReallocN (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x40A729: ??? (in /usr/bin/virsh)
==800== by 0x4C62EDE: ??? (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x4C61C86: virEventRunDefaultImpl (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x41C031: ??? (in /usr/bin/virsh)
==800== by 0x4C73BD1: ??? (in /usr/lib64/libvirt.so.0.9.8)
==800== by 0x32E64077F0: start_thread (in /lib64/libpthread-2.12.so)
==800== by 0x32E5CE570C: clone (in /lib64/libc-2.12.so)
==800==
==800== LEAK SUMMARY:
==800== definitely lost: 2,048 bytes in 2 blocks
==800== indirectly lost: 0 bytes in 0 blocks
==800== possibly lost: 0 bytes in 0 blocks
==800== still reachable: 127,073 bytes in 1,344 blocks
==800== suppressed: 0 bytes in 0 blocks
==800== Reachable blocks (those to which a pointer was found) are not shown.
Expected results:
avoid memory leak.
(In reply to comment #4)
> (In reply to comment #2)
> > It exists a quite big leaks on virConsoleEventOnStdin and
> > virConsoleEventOnStdout.
>
> Do you know where the leak is?
I tried to avoid memory leaks on functions virConsoleEventOnStdin, virConsoleEventOnStdout and virConsoleEventOnStream, but my change
has effect on actual 'virsh console' function, it must be my mistake,
so I need to check my modification again.
commit 2b603dcb6c2b8d07044241c9feaf0dfafecad09d
Author: Alex Jia <ajia>
Date: Tue Dec 20 17:40:13 2011 +0800
console: plug memory leaks
Using 'virReallocN' to allocate memory on virConsoleEventOnStdin,
virConsoleEventOnStdout and virConsoleEventOnStream, however, the
cleanup function virConsoleShutdown hasn't released these memory.
* tools/console.c: fix memory leaks on virConsoleShutdown.
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
Description of problem: Memleak when "run virsh console guest". Version-Release number of selected component (if applicable): libvirt-0.9.8-1.el6.x86_64 How reproducible: always Steps to Reproduce: 1. make sure have a working serial on guest like: <serial type='pty'> <source path='/dev/pts/12'/> <target port='0'/> <alias name='serial0'/> </serial> 2. add "console=tty0 console=ttyS0" to the kernel line of guest. 3. reboot the guest 4. valgrind -v --leak-check=full virsh console kvm1 5. login in the guest on step5 and do some operation. 6. leave the console with "Ctrl + ]" Actual results: ==800== 1,024 bytes in 1 blocks are definitely lost in loss record 26 of 33 ==800== at 0x4A05FDE: malloc (vg_replace_malloc.c:236) ==800== by 0x4A06167: realloc (vg_replace_malloc.c:525) ==800== by 0x4C6A6EB: virReallocN (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x40A867: ??? (in /usr/bin/virsh) ==800== by 0x4C62EDE: ??? (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x4C61C86: virEventRunDefaultImpl (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x41C031: ??? (in /usr/bin/virsh) ==800== by 0x4C73BD1: ??? (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x32E64077F0: start_thread (in /lib64/libpthread-2.12.so) ==800== by 0x32E5CE570C: clone (in /lib64/libc-2.12.so) ==800== ==800== 1,024 bytes in 1 blocks are definitely lost in loss record 27 of 33 ==800== at 0x4A0610F: realloc (vg_replace_malloc.c:525) ==800== by 0x4C6A6EB: virReallocN (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x40A729: ??? (in /usr/bin/virsh) ==800== by 0x4C62EDE: ??? (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x4C61C86: virEventRunDefaultImpl (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x41C031: ??? (in /usr/bin/virsh) ==800== by 0x4C73BD1: ??? (in /usr/lib64/libvirt.so.0.9.8) ==800== by 0x32E64077F0: start_thread (in /lib64/libpthread-2.12.so) ==800== by 0x32E5CE570C: clone (in /lib64/libc-2.12.so) ==800== ==800== LEAK SUMMARY: ==800== definitely lost: 2,048 bytes in 2 blocks ==800== indirectly lost: 0 bytes in 0 blocks ==800== possibly lost: 0 bytes in 0 blocks ==800== still reachable: 127,073 bytes in 1,344 blocks ==800== suppressed: 0 bytes in 0 blocks ==800== Reachable blocks (those to which a pointer was found) are not shown. Expected results: avoid memory leak.