Package: libvirt-bin Version: 0.9.12-11 Severity: important Tags: patch Hello, In our workload we use LVM for VM storage and continuously create and destroy instances. We noticed that over time libvirtd memory usage grows until libvirt cannot fork anymore (to spawn LVM tools):
virFork:279 : cannot fork child process: Cannot allocate memory libvirtd won't crash (yet), but it will eventually mark all the storage pools as offline. I've tracked down the issue to a memory leak in virStorageBackendLogicalMakeVol (creating a volume triggers a refresh of the pool): 50,229,128 (820,736 direct, 49,408,392 indirect) bytes in 3,664 blocks are definitely lost in loss record 883 of 883 at 0x4C28BED: malloc (vg_replace_malloc.c:263) by 0x4C28D6F: realloc (vg_replace_malloc.c:632) by 0x805ADF3: re_compile_internal (regcomp.c:760) by 0x805B1AB: regcomp (regcomp.c:506) by 0x4D13CD: virStorageBackendLogicalMakeVol (storage_backend_logical.c:203) by 0x4CE09B: virStorageBackendRunProgRegex (storage_backend.c:1512) by 0x4D0A8E: virStorageBackendLogicalFindLVs (storage_backend_logical.c:306) by 0x4D1971: virStorageBackendLogicalRefreshPool (storage_backend_logical.c:591) by 0x4C9596: storagePoolRefresh (storage_driver.c:904) by 0x511CE44: virStoragePoolRefresh (libvirt.c:12116) by 0x436687: remoteDispatchStoragePoolRefreshHelper (remote_dispatch.h:11759) by 0x515B7FF: virNetServerProgramDispatch (virnetserverprogram.c:423) This bug has already been fixed upstream with commit 71da3b66 (which also reverts afc4631b). This fix is already included in the experimental package, but since it's self-contained and minimally intrusive I suggest to backport it for Wheezy (and squeeze-backports?). Patch is attached. Luca -- System Information: Debian Release: 7.0 APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libvirt-bin depends on: ii adduser 3.113+nmu3 ii gettext-base 0.18.1.1-9 ii libavahi-client3 0.6.31-2 ii libavahi-common3 0.6.31-2 ii libblkid1 2.20.1-5.3 ii libc6 2.13-38 ii libcap-ng0 0.6.6-2 ii libdbus-1-3 1.6.8-1 ii libdevmapper1.02.1 2:1.02.74-7 ii libgcrypt11 1.5.0-5 ii libgnutls26 2.12.20-4 ii libnetcf1 0.1.9-2 ii libnl1 1.1-7 ii libnuma1 2.0.8~rc4-1 ii libparted0debian1 2.3-12 ii libpcap0.8 1.3.0-1 ii libpciaccess0 0.13.1-2 ii libreadline6 6.2+dfsg-0.1 ii libsasl2-2 2.1.25.dfsg1-6 ii libudev0 175-7.1 ii libvirt0 0.9.12-11 ii libxenstore3.0 4.1.4-2 ii libxml2 2.8.0+dfsg1-7+nmu1 ii libyajl2 2.0.4-2 ii logrotate 3.8.1-4 Versions of packages libvirt-bin recommends: ii bridge-utils 1.5-6 ii dmidecode 2.11-9 ii dnsmasq-base 2.62-3+deb7u1 ii ebtables 2.0.10.4-1 ii gawk 1:4.0.1+dfsg-2.1 ii iproute 20120521-3+b3 ii iptables 1.4.14-3.1 ii libxml2-utils 2.8.0+dfsg1-7+nmu1 ii netcat-openbsd 1.105-7 ii parted 2.3-12 ii qemu 1.1.2+dfsg-6a ii qemu-kvm 1.1.2+dfsg-6 Versions of packages libvirt-bin suggests: ii policykit-1 0.105-3 ii radvd 1:1.8.5-1 -- Configuration Files: /etc/default/libvirt-bin changed [not included] /etc/init.d/libvirt-bin changed [not included] -- no debconf information *** /tmp/fix-leak.diff diff -Nru libvirt-0.9.12/debian/changelog libvirt-0.9.12/debian/changelog --- libvirt-0.9.12/debian/changelog 2013-03-06 11:27:13.000000000 +0000 +++ libvirt-0.9.12/debian/changelog 2013-04-11 09:53:13.000000000 +0100 @@ -1,3 +1,10 @@ +libvirt (0.9.12-11.1) UNRELEASED; urgency=low + + * Non-maintainer upload. + * Backport upstream 71da3b66 (fix leak in virStorageBackendLogicalMakeVol) + + -- Luca Tettamanti <ltettama...@acunu.com> Thu, 11 Apr 2013 09:53:03 +0100 + libvirt (0.9.12-11) unstable; urgency=low * [422c506] Use "getent passwd" instead of the non existing "getent user" diff -Nru libvirt-0.9.12/debian/patches/fix-leak-virStorageBackendLogicalMakeVol.patch libvirt-0.9.12/debian/patches/fix-leak-virStorageBackendLogicalMakeVol.patch --- libvirt-0.9.12/debian/patches/fix-leak-virStorageBackendLogicalMakeVol.patch 1970-01-01 01:00:00.000000000 +0100 +++ libvirt-0.9.12/debian/patches/fix-leak-virStorageBackendLogicalMakeVol.patch 2013-04-11 09:55:16.000000000 +0100 @@ -0,0 +1,22 @@ +Index: libvirt-0.9.12/src/storage/storage_backend_logical.c +=================================================================== +--- libvirt-0.9.12.orig/src/storage/storage_backend_logical.c 2012-04-18 06:07:44.000000000 +0100 ++++ libvirt-0.9.12/src/storage/storage_backend_logical.c 2013-04-11 09:55:12.054035440 +0100 +@@ -204,13 +204,16 @@ + if (err != 0) { + char error[100]; + regerror(err, reg, error, sizeof(error)); ++ regfree(reg); + virStorageReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to compile regex %s"), + error); + goto cleanup; + } + +- if (regexec(reg, groups[3], nvars, vars, 0) != 0) { ++ err = regexec(reg, groups[3], nvars, vars, 0); ++ regfree(reg); ++ if (err != 0) { + virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed volume extent devices value")); + goto cleanup; diff -Nru libvirt-0.9.12/debian/patches/series libvirt-0.9.12/debian/patches/series --- libvirt-0.9.12/debian/patches/series 2013-03-06 07:24:52.000000000 +0000 +++ libvirt-0.9.12/debian/patches/series 2013-04-11 09:53:38.000000000 +0100 @@ -18,3 +18,4 @@ qemu-Fix-off-by-one-error-while-unescaping-monitor-s.patch rpc-Fix-crash-on-error-paths-of-message-dispatching.patch qemu-Add-support-for-no-user-config.patch +fix-leak-virStorageBackendLogicalMakeVol.patch -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org