Bug 851401

Summary: libvirtd memory leak
Product: Red Hat Enterprise Linux 6 Reporter: yanbing du <ydu>
Component: libvirtAssignee: Gunannan Ren <gren>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.4CC: acathrow, ajia, dallan, dyasny, dyuan, eblake, mzhan, whuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-08 14:19:43 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:

Description yanbing du 2012-08-24 05:39:41 UTC
Description of problem:
valgrind defects some errors and memory leak.


Version-Release number of selected component (if applicable):
libvirt-0.10.0-0rc1.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Stop libvirtd service.
2. run # valgrind libvirtd -d


Actual results:
[root@intel-w3520-8-2 ~]# valgrind libvirtd -d
==26158== Memcheck, a memory error detector
==26158== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==26158== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==26158== Command: libvirtd -d
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x334AD2E2E0: __strcasestr_sse42 (in /lib64/libc-2.12.so)
==26158==    by 0x3361404004: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x334AD2E2E4: __strcasestr_sse42 (in /lib64/libc-2.12.so)
==26158==    by 0x3361404004: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x334AD2E2EC: __strcasestr_sse42 (in /lib64/libc-2.12.so)
==26158==    by 0x3361404004: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x336140400D: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x3361404016: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Use of uninitialised value of size 8
==26158==    at 0x3361404049: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x3361404047: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x3361404057: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Conditional jump or move depends on uninitialised value(s)
==26158==    at 0x336140408F: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26158== Use of uninitialised value of size 8
==26158==    at 0x3361404091: numa_node_size64 (in /usr/lib64/libnuma.so.1)
==26158==    by 0x3361405A48: ??? (in /usr/lib64/libnuma.so.1)
==26158==    by 0x334A40E534: _dl_init (in /lib64/ld-2.12.so)
==26158==    by 0x334A400B39: ??? (in /lib64/ld-2.12.so)
==26158==    by 0x1: ???
==26158==    by 0x7FF00075E: ???
==26158==    by 0x7FF000767: ???
==26158== 
==26159== 
==26159== HEAP SUMMARY:
==26159==     in use at exit: 127,514 bytes in 1,376 blocks
==26159==   total heap usage: 2,854 allocs, 1,478 frees, 303,764 bytes allocated
==26159== 
==26159== LEAK SUMMARY:
==26159==    definitely lost: 0 bytes in 0 blocks
==26159==    indirectly lost: 0 bytes in 0 blocks
==26159==      possibly lost: 349 bytes in 18 blocks
==26159==    still reachable: 127,165 bytes in 1,358 blocks
==26159==         suppressed: 0 bytes in 0 blocks
==26159== Rerun with --leak-check=full to see details of leaked memory
==26159== 
==26159== For counts of detected and suppressed errors, rerun with: -v
==26159== Use --track-origins=yes to see where uninitialised values come from
==26159== ERROR SUMMARY: 45 errors from 10 contexts (suppressed: 8 from 6)
==26158== 
==26158== HEAP SUMMARY:
==26158==     in use at exit: 127,514 bytes in 1,376 blocks
==26158==   total heap usage: 2,850 allocs, 1,474 frees, 303,506 bytes allocated
==26158== 
==26158== LEAK SUMMARY:
==26158==    definitely lost: 232 bytes in 1 blocks
==26158==    indirectly lost: 58 bytes in 5 blocks
==26158==      possibly lost: 349 bytes in 18 blocks
==26158==    still reachable: 126,875 bytes in 1,352 blocks
==26158==         suppressed: 0 bytes in 0 blocks
==26158== Rerun with --leak-check=full to see details of leaked memory
==26158== 
==26158== For counts of detected and suppressed errors, rerun with: -v
==26158== Use --track-origins=yes to see where uninitialised values come from
==26158== ERROR SUMMARY: 45 errors from 10 contexts (suppressed: 8 from 6)
[root@intel-w3520-8-2 ~]# ==26160== Thread 12:
==26160== Invalid read of size 8
==26160==    at 0x334AD3228D: __strspn_sse42 (in /lib64/libc-2.12.so)
==26160==    by 0x30EB661352: virDiskNameToIndex (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB6819BE: virDomainDiskInsertPreAlloced (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69B23D: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69F8A8: virDomainLoadAllConfigs (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x449119: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB6E451A: virStateInitialize (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x421300: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB65EBF8: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x334B007850: start_thread (in /lib64/libpthread-2.12.so)
==26160==    by 0x334ACE767C: clone (in /lib64/libc-2.12.so)
==26160==  Address 0x4e4b970 is 0 bytes inside a block of size 4 alloc'd
==26160==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==26160==    by 0x3351CA695D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
==26160==    by 0x30EB68D41E: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69B220: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69F8A8: virDomainLoadAllConfigs (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x449119: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB6E451A: virStateInitialize (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x421300: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB65EBF8: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x334B007850: start_thread (in /lib64/libpthread-2.12.so)
==26160==    by 0x334ACE767C: clone (in /lib64/libc-2.12.so)
==26160== 
==26160== Invalid read of size 8
==26160==    at 0x334AD3228D: __strspn_sse42 (in /lib64/libc-2.12.so)
==26160==    by 0x30EB661352: virDiskNameToIndex (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB6819CA: virDomainDiskInsertPreAlloced (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69B23D: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69F8A8: virDomainLoadAllConfigs (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x449119: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB6E451A: virStateInitialize (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x421300: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB65EBF8: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x334B007850: start_thread (in /lib64/libpthread-2.12.so)
==26160==    by 0x334ACE767C: clone (in /lib64/libc-2.12.so)
==26160==  Address 0x4e4cb60 is 0 bytes inside a block of size 4 alloc'd
==26160==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==26160==    by 0x3351CA695D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
==26160==    by 0x30EB68D41E: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69B220: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x30EB69F8A8: virDomainLoadAllConfigs (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x449119: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB6E451A: virStateInitialize (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x421300: ??? (in /usr/sbin/libvirtd)
==26160==    by 0x30EB65EBF8: ??? (in /usr/lib64/libvirt.so.0.10.0)
==26160==    by 0x334B007850: start_thread (in /lib64/libpthread-2.12.so)
==26160==    by 0x334ACE767C: clone (in /lib64/libc-2.12.so)
==26160== 
[root@intel-w3520-8-2 ~]# ps aux|grep libvirtd
root     26160  3.4  1.7 536276 141892 ?       Sl   13:02   0:06 valgrind libvirtd -d
root     26286  0.0  0.0 103244   860 pts/2    S+   13:05   0:00 grep libvirtd
[root@intel-w3520-8-2 ~]# kill 26160
[root@intel-w3520-8-2 ~]# ==26160== 
==26160== HEAP SUMMARY:
==26160==     in use at exit: 956,598 bytes in 9,669 blocks
==26160==   total heap usage: 179,210 allocs, 169,541 frees, 451,276,713 bytes allocated
==26160== 
==26160== LEAK SUMMARY:
==26160==    definitely lost: 0 bytes in 0 blocks
==26160==    indirectly lost: 0 bytes in 0 blocks
==26160==      possibly lost: 4,048 bytes in 11 blocks
==26160==    still reachable: 952,550 bytes in 9,658 blocks
==26160==         suppressed: 0 bytes in 0 blocks
==26160== Rerun with --leak-check=full to see details of leaked memory
==26160== 
==26160== For counts of detected and suppressed errors, rerun with: -v
==26160== Use --track-origins=yes to see where uninitialised values come from
==26160== ERROR SUMMARY: 49 errors from 12 contexts (suppressed: 29 from 9)



Expected results:
Fix memory leak and errors.


Additional info:

Comment 2 Alex Jia 2012-08-24 07:05:51 UTC
BTW, the bug 769517 is used for tracking libvirtd memory leaks on RHEL6.3.

Comment 3 Dave Allan 2012-10-08 14:19:43 UTC
These BZs with valgrind logs are really not all that useful as many of the valgrind messages do not reflect specific problems that need to be fixed and the logs become stale as soon as new builds are released.  I'm going to close this BZ, but if there are specific leaks that are present in the most recent builds, please open BZs for them.  We are also working to implement nightly valgrind and coverity runs so it should not be necessary to run static analysis tools manually.