Bug 810613 - Memory leak in virInitialize
Memory leak in virInitialize
Status: CLOSED NOTABUG
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Libvirt Maintainers
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-07 04:25 EDT by Richard W.M. Jones
Modified: 2013-12-13 07:41 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-13 07:41:08 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2012-04-07 04:25:02 EDT
Description of problem:

==24471== Memcheck, a memory error detector
==24471== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==24471== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==24471== Command: /home/rjones/d/libguestfs-1.16/df/.libs/lt-virt-df
==24471== Parent PID: 24470
==24471== 
==24471== 
==24471== HEAP SUMMARY:
==24471==     in use at exit: 130,697 bytes in 1,295 blocks
==24471==   total heap usage: 4,367 allocs, 3,072 frees, 104,142,842 bytes allocated
==24471== 
==24471== 21 bytes in 1 blocks are definitely lost in loss record 70 of 185
==24471==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==24471==    by 0x3B16885B51: strdup (in /usr/lib64/libc-2.15.so)
==24471==    by 0x3B28805CBB: p11_kit_registered_module_to_name (in /usr/lib64/libp11-kit.so.0.0.0)
==24471==    by 0x3B2A048294: gnutls_pkcs11_init (in /usr/lib64/libgnutls.so.26.22.0)
==24471==    by 0x3B2A031CE1: gnutls_global_init (in /usr/lib64/libgnutls.so.26.22.0)
==24471==    by 0x3B326CE219: virInitialize (in /usr/lib64/libvirt.so.0.9.10)
==24471==    by 0x3B326CEF56: virConnectOpenReadOnly (in /usr/lib64/libvirt.so.0.9.10)
==24471==    by 0x4045B6: get_domains_from_libvirt (domains.c:111)
==24471==    by 0x40308A: main (main.c:264)
==24471== 
==24471== LEAK SUMMARY:
==24471==    definitely lost: 21 bytes in 1 blocks
==24471==    indirectly lost: 0 bytes in 0 blocks
==24471==      possibly lost: 0 bytes in 0 blocks
==24471==    still reachable: 130,327 bytes in 1,276 blocks
==24471==         suppressed: 349 bytes in 18 blocks
==24471== Reachable blocks (those to which a pointer was found) are not shown.
==24471== To see them, rerun with: --leak-check=full --show-reachable=yes
==24471== 
==24471== For counts of detected and suppressed errors, rerun with: -v
==24471== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 20 from 20)


Version-Release number of selected component (if applicable):

$ rpm -qf /usr/lib64/libp11-kit.so.0.0.0
p11-kit-0.12-1.fc17.x86_64
$ rpm -qf /usr/lib64/libgnutls.so.26.22.0
gnutls-2.12.17-1.fc17.x86_64
$ rpm -qf /usr/lib64/libvirt.so.0.9.10
libvirt-client-0.9.10-2.fc17.x86_64
$ ./run ./fish/guestfish version
major: 1
minor: 16
release: 15
extra: 

(also happens on 1.17.25)

How reproducible:

100% on a machine that has 1 libvirt domain
0% on a basically identical machine that has > 1 domains
Comment 1 Richard W.M. Jones 2012-04-07 04:31:49 EDT
This is the reproducing command:

./run valgrind --leak-check=full --suppressions=tests/extra/suppressions ./df/virt-df -c qemu:///system
Comment 2 Richard W.M. Jones 2012-04-07 05:04:46 EDT
Bug also occurs with
libvirt-client-0.9.11-1.fc17.x86_64
from Fedora updates-testing.
Comment 3 Richard W.M. Jones 2012-04-07 05:38:12 EDT
Looks like a bug in libvirt.  I raised the issue on libvir-list:

https://www.redhat.com/archives/libvir-list/2012-April/msg00309.html
Comment 4 Richard W.M. Jones 2012-04-11 13:19:20 EDT
Reassigning to libvirt (note that the real bug is lack
of thread safety in gnutls).

For discussion, see the thread in comment 3.
Comment 5 Daniel Berrange 2012-04-11 13:46:53 EDT
Well there's nothing we can really do about this in libvirt.  My suggestion is to add a wildcard against  'gnutls_global_init' to your valgrind suppressions file.
Comment 6 Dave Allan 2012-04-12 10:01:34 EDT
Should this be moved to gnutls or closed as CANTFIX?

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