nova-compute memory leak
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libvirt-python (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Trusty |
Fix Released
|
High
|
Unassigned |
Bug Description
[Impact]
* nova-compute service which uses python-libvirt continuously grows the heap size
[Test Case]
* using valgrind tool can detect memory leak, valgrind --leak-check=full /usr/bin/python ./d.py
after patch applied, should be 0 bytes definitely lost.
==11243== LEAK SUMMARY:
==11243== definitely lost: 0 bytes in 0 blocks
==11243== indirectly lost: 0 bytes in 0 blocks
==11243== possibly lost: 1,064 bytes in 2 blocks
==11243== still reachable: 984,453 bytes in 1,757 blocks
==11243== suppressed: 0 bytes in 0 blocks
[Regression Potential]
* patch backported from upstream, and has been fixed in utopic.
[Other Info]
* This bug fix has been fixed upstream http://
We found a symptom like memory leak of nova-compute.
Even though there are no activities of OpenStack, the heap of
nova-compute continuously grows as approximately 100KB/sec.
After running for a week the virtual space size of nova-compute
almost reached 2.5GB. The initial size was around 1.6GB.
Is this bug at upstream? And if this is bug, is there workaround or solution to avoid memory leak.
The following is detail information
root# while true;
> do
> date
> pmap -x 8506 | head
> sleep 60
> done
Tue Sep 2 08:32:28 UTC 2014
8506: /usr/bin/python /usr/bin/
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 2804 1832 0 r-x-- python2.7
00000000008bc000 4 4 4 r---- python2.7
00000000008bd000 468 368 252 rw--- python2.7
0000000000932000 72 64 64 rw--- [ anon ]
0000000000cdc000 19948 19708 19708 rw--- [ anon ] *** heap
00007f47b4000000 132 132 132 rw--- [ anon ]
00007f47b4021000 65404 0 0 ----- [ anon ]
00007f47bb7ff000 4 0 0 ----- [ anon ]
Tue Sep 2 08:33:28 UTC 2014
8506: /usr/bin/python /usr/bin/
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 2804 1832 0 r-x-- python2.7
00000000008bc000 4 4 4 r---- python2.7
00000000008bd000 468 368 252 rw--- python2.7
0000000000932000 72 64 64 rw--- [ anon ]
0000000000cdc000 20080 19840 19840 rw--- [ anon ]
00007f47b4000000 132 132 132 rw--- [ anon ]
00007f47b4021000 65404 0 0 ----- [ anon ]
00007f47bb7ff000 4 0 0 ----- [ anon ]
Tue Sep 2 08:34:28 UTC 2014
8506: /usr/bin/python /usr/bin/
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 2804 1832 0 r-x-- python2.7
00000000008bc000 4 4 4 r---- python2.7
00000000008bd000 468 368 252 rw--- python2.7
0000000000932000 72 64 64 rw--- [ anon ]
0000000000cdc000 20080 19848 19848 rw--- [ anon ]
00007f47b4000000 132 132 132 rw--- [ anon ]
00007f47b4021000 65404 0 0 ----- [ anon ]
00007f47bb7ff000 4 0 0 ----- [ anon ]
Tue Sep 2 08:35:28 UTC 2014
8506: /usr/bin/python /usr/bin/
Address Kbytes RSS Dirty Mode Mapping
0000000000400000 2804 1832 0 r-x-- python2.7
00000000008bc000 4 4 4 r---- python2.7
00000000008bd000 468 368 252 rw--- python2.7
0000000000932000 72 64 64 rw--- [ anon ]
0000000000cdc000 20232 19992 19992 rw--- [ anon ]
00007f47b4000000 132 132 132 rw--- [ anon ]
00007f47b4021000 65404 0 0 ----- [ anon ]
00007f47bb7ff000 4 0 0 ----- [ anon ]
- Software versions
ii nova-common 1:2014.
ii nova-compute 1:2014.
ii nova-compute-kvm 1:2014.
ii nova-compute-
ii python 2.7.5-5ubuntu3 amd64 interactive high-level object-oriented language (default version)
- nova-compute.conf
[DEFAULT]
compute_
[libvirt]
virt_type=kvm
- nova.conf
[DEFAULT]
scheduler_
dhcpbridge_flagfile = /etc/nova/nova.conf
dhcpbridge = /usr/bin/
logdir = /var/log/nova
state_path = /var/lib/nova
lock_path = /var/lock/nova
force_dhcp_release = True
iscsi_helper = tgtadm
libvirt_
connection_type = libvirt
root_helper = sudo nova-rootwrap /etc/nova/
verbose = True
ec2_private_
api_paste_config = /etc/nova/
volumes_path = /var/lib/
enabled_apis = ec2,osapi_
auth_strategy = keystone
rpc_backend = rabbit
rabbit_host = xxx.xxx.xxx.xxx
rabbit_password = *********
my_ip = yyy.yyy.yyy.yyy
vnc_enabled = True
vncserver_listen = 0.0.0.0
vncserver_
novncproxy_base_url = http://
glance_host = xxx.xxx.xxx.xxx
network_api_class = nova.network.
security_group_api = nova
firewall_driver = nova.virt.
allow_same_
multi_host = True
send_arp_for_ha = True
share_dhcp_address = True
public_interface = bond0
network_size = 256
block_device_
block_device_
network_manager = nova.network.
flat_network_bridge = br100
flat_interface = bond1
libvirt_images_type = rbd
libvirt_
libvirt_
rbd_user = cinder
rbd_secret_uuid = xxxxxxxx-
[database]
connection = *********
[keystone_
auth_uri = http://
auth_host = xxx.xxx.xxx.xxx
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = *********
[osapi_v3]
enabled = True
Changed in nova (Ubuntu): | |
assignee: | nobody → Yaguang Tang (heut2008) |
affects: | nova (Ubuntu) → libvirt-python (Ubuntu) |
description: | updated |
Changed in libvirt-python (Ubuntu): | |
assignee: | Yaguang Tang (heut2008) → nobody |
Changed in libvirt-python (Ubuntu): | |
importance: | Undecided → High |
Changed in libvirt-python (Ubuntu Trusty): | |
importance: | Undecided → High |
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 valgrind/ vgpreload_ memcheck- amd64-linux. so) libvirt. so.0.1002. 2) libvirt. so.0.1002. 2) codePayload (in /usr/lib/ libvirt. so.0.1002. 2) gramCall (in /usr/lib/ libvirt. so.0.1002. 2) libvirt. so.0.1002. 2) libvirt. so.0.1002. 2) libvirt. so.0.1002. 2) virDomainGetXML Desc (in /usr/lib/ python2. 7/dist- packages/ libvirtmod. so)
...
==25610== 12,682 bytes in 4 blocks are definitely lost in loss record 227 of 236
==25610== at 0x4C2AB80: malloc (in /usr/lib/
==25610== by 0x5183844: xdr_string (xdr.c:788)
==25610== by 0x67E1A8D: ??? (in /usr/lib/
==25610== by 0x67E4CF8: ??? (in /usr/lib/
==25610== by 0x67FDA61: virNetMessageDe
==25610== by 0x67F2AEB: virNetClientPro
==25610== by 0x67C7025: ??? (in /usr/lib/
==25610== by 0x67D0174: ??? (in /usr/lib/
==25610== by 0x6787907: virDomainGetXMLDesc (in /usr/lib/
==25610== by 0x642E41D: libvirt_
==25610== by 0x52C6D4: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==25610== by 0x55C593: PyEval_EvalCodeEx (...