Red Hat Bugzilla – Bug 770942
memory leaks on libvirt_virDomainBlockStatsFlags
Last modified: 2012-06-20 02:40:41 EDT
Description of problem: Memory leak on libvirt_virDomainBlockStatsFlags API. Version-Release number of selected component (if applicable): libvirt-python-0.9.9-0rc1.el6.x86_64.rpm How reproducible: always Steps to Reproduce: 1. Paste the following codes into test.py: import libvirt con = libvirt.open(None) dom = con.lookupByName('foo') dom.blockStatsFlags("/var/lib/libvirt/images/foo.img", 0) 2. valgrind -v --leak-check=full python test.py Actual results: ==18725== 160 bytes in 5 blocks are definitely lost in loss record 1,525 of 2,083 ==18725== at 0x4A05FDE: malloc (vg_replace_malloc.c:236) ==18725== by 0x39E1A85EC3: PyObject_Malloc (obmalloc.c:935) ==18725== by 0x39E1A77831: _PyLong_New (longobject.c:75) ==18725== by 0x39E1A79EB6: PyLong_FromLongLong (longobject.c:864) ==18725== by 0xB8FAD08: libvirt_virDomainBlockStatsFlags (libvirt-override.c:160) ==18725== by 0x39E1ADE7F3: PyEval_EvalFrameEx (ceval.c:3794) ==18725== by 0x39E1ADF99E: PyEval_EvalFrameEx (ceval.c:3880) ==18725== by 0x39E1AE0466: PyEval_EvalCodeEx (ceval.c:3044) ==18725== by 0x39E1AE0541: PyEval_EvalCode (ceval.c:545) ==18725== by 0x39E1AFB88B: run_mod (pythonrun.c:1351) ==18725== by 0x39E1AFB95F: PyRun_FileExFlags (pythonrun.c:1337) ==18725== by 0x39E1AFCE4B: PyRun_SimpleFileExFlags (pythonrun.c:941) ==18725== ==18725== 258 bytes in 5 blocks are definitely lost in loss record 1,590 of 2,083 ==18725== at 0x4A05FDE: malloc (vg_replace_malloc.c:236) ==18725== by 0x39E1A85EC3: PyObject_Malloc (obmalloc.c:935) ==18725== by 0x39E1A9053C: PyString_FromString (stringobject.c:138) ==18725== by 0xB8FAD1C: libvirt_virDomainBlockStatsFlags (libvirt-override.c:177) ==18725== by 0x39E1ADE7F3: PyEval_EvalFrameEx (ceval.c:3794) ==18725== by 0x39E1ADF99E: PyEval_EvalFrameEx (ceval.c:3880) ==18725== by 0x39E1AE0466: PyEval_EvalCodeEx (ceval.c:3044) ==18725== by 0x39E1AE0541: PyEval_EvalCode (ceval.c:545) ==18725== by 0x39E1AFB88B: run_mod (pythonrun.c:1351) ==18725== by 0x39E1AFB95F: PyRun_FileExFlags (pythonrun.c:1337) ==18725== by 0x39E1AFCE4B: PyRun_SimpleFileExFlags (pythonrun.c:941) ==18725== by 0x39E1B094CE: Py_Main (main.c:577) Expected results: Fix memory leaks. Additional info:
The following patch has fixed the issue together, In POST: commit 56cec18d761a1f99862c43811de60380c65881e6 Author: Guannan Ren <gren@redhat.com> Date: Fri Feb 10 18:17:26 2012 +0800 python: make other APIs share common {get, set}PyVirTypedParameter *libvirt_virDomainBlockStatsFlags *libvirt_virDomainGetSchedulerParameters *libvirt_virDomainGetSchedulerParametersFlags *libvirt_virDomainSetSchedulerParameters *libvirt_virDomainSetSchedulerParametersFlags *libvirt_virDomainSetBlkioParameters *libvirt_virDomainGetBlkioParameters *libvirt_virDomainSetMemoryParameters *libvirt_virDomainGetMemoryParameters *libvirt_virDomainSetBlockIoTune *libvirt_virDomainGetBlockIoTune
This made 0.9.10 release so should be fixed in libvirt-0.9.10-1.el6 Daniel
I tested this with: libvirt-0.9.10-1.el6.x86_64 Test passed. valgrind test result is attached.
Created attachment 564611 [details] valgrind result
Move it to VERIFIED per Comment 3 and Comment 4.
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