Comment 1 for bug 1365250

Revision history for this message
Takashi Aosawa (t-aosawa) wrote :

At least python-libvirt, which nova-compute uses, seems to leak memory when handling XML data. Find the file d.py attached which reproduces a similar problem.

ii python-libvirt 1.2.2-0ubuntu1 amd64 libvirt Python bindings

valgrind can detect "definitely lost".

# ps -ef|grep d.py
root 25578 17888 24 14:40 pts/0 00:00:03 python ./d.py 100000
root 25594 25581 0 14:41 pts/2 00:00:00 grep --color=auto d.py
# pmap -x 25578|head
25578: python ./d.py 100000
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 2804 1448 0 r-x-- python2.7
00000000008bc000 4 4 4 r---- python2.7
00000000008bd000 468 260 176 rw--- python2.7
0000000000932000 72 64 64 rw--- [ anon ]
0000000001a82000 72328 72296 72296 rw--- [ anon ]
00007f0851a3a000 28 8 0 r-x-- libffi.so.6.0.1
00007f0851a41000 2044 0 0 ----- libffi.so.6.0.1
00007f0851c40000 4 4 4 r---- libffi.so.6.0.1
# pmap -x 25578|head
25578: python ./d.py 100000
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 2804 1448 0 r-x-- python2.7
00000000008bc000 4 4 4 r---- python2.7
00000000008bd000 468 260 176 rw--- python2.7
0000000000932000 72 64 64 rw--- [ anon ]
0000000001a82000 87900 87848 87848 rw--- [ anon ]
00007f0851a3a000 28 8 0 r-x-- libffi.so.6.0.1
00007f0851a41000 2044 0 0 ----- libffi.so.6.0.1
00007f0851c40000 4 4 4 r---- libffi.so.6.0.1
# pmap -x 25578|head
25578: python ./d.py 100000
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 2804 1448 0 r-x-- python2.7
00000000008bc000 4 4 4 r---- python2.7
00000000008bd000 468 260 176 rw--- python2.7
0000000000932000 72 64 64 rw--- [ anon ]
0000000001a82000 120676 120636 120636 rw--- [ anon ]
00007f0851a3a000 28 8 0 r-x-- libffi.so.6.0.1
00007f0851a41000 2044 0 0 ----- libffi.so.6.0.1
00007f0851c40000 4 4 4 r---- libffi.so.6.0.1

# valgrind --leak-check=full /usr/bin/python ./d.py
...
==25610== 12,682 bytes in 4 blocks are definitely lost in loss record 227 of 236
==25610== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25610== by 0x5183844: xdr_string (xdr.c:788)
==25610== by 0x67E1A8D: ??? (in /usr/lib/libvirt.so.0.1002.2)
==25610== by 0x67E4CF8: ??? (in /usr/lib/libvirt.so.0.1002.2)
==25610== by 0x67FDA61: virNetMessageDecodePayload (in /usr/lib/libvirt.so.0.1002.2)
==25610== by 0x67F2AEB: virNetClientProgramCall (in /usr/lib/libvirt.so.0.1002.2)
==25610== by 0x67C7025: ??? (in /usr/lib/libvirt.so.0.1002.2)
==25610== by 0x67D0174: ??? (in /usr/lib/libvirt.so.0.1002.2)
==25610== by 0x6787907: virDomainGetXMLDesc (in /usr/lib/libvirt.so.0.1002.2)
==25610== by 0x642E41D: libvirt_virDomainGetXMLDesc (in /usr/lib/python2.7/dist-packages/libvirtmod.so)
==25610== by 0x52C6D4: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==25610== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==25610==
==25610== LEAK SUMMARY:
==25610== definitely lost: 12,682 bytes in 4 blocks
==25610== indirectly lost: 0 bytes in 0 blocks
==25610== possibly lost: 1,064 bytes in 2 blocks
==25610== still reachable: 791,708 bytes in 1,186 blocks
==25610== suppressed: 0 bytes in 0 blocks