-
Notifications
You must be signed in to change notification settings - Fork 76
Closed
Description
The issue is reported by Ryan Rozanski rrozansk@cisco.com (CrossWorks team at Cisco)
Expected Behavior
Memory consumption for YDK based application should be stable (going up and down) over big period of time.
Current Behavior
Here is some snipped output from 'top', which shows the memory keeps rising over time:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
930 root 20 0 230248 65008 16756 S 5.7 0.1 2:36.31 python
930 root 20 0 236780 71540 16756 R 5.7 0.1 3:02.55 python
930 root 20 0 239784 74544 16756 S 5.0 0.1 3:14.81 python
930 root 20 0 242016 76776 16756 S 4.3 0.1 3:23.65 python
We see a larger leak when running python binary, but this script only tests providers.
Python Script
"""
Script showcasing the YDK memory leak for Providers...
"""
from time import sleep
from ydk.path import Repository
from ydk.providers import NetconfServiceProvider
from mem_top import mem_top
REPOSITORY = Repository('/opt/robot/data/cache')
PROVIDER_PARAMETERS = {
'repo': REPOSITORY,
'address': '192.168.123.111',
'username': 'nso',
'password': 'cisco123',
'port': '22',
}
MEMORY_PARAMETERS = {
'limit': 1000, # limit of top lines per section
'width': 1000, # width of each line in chars
'sep': '\n', # char to separate lines with
'refs_format': '{num}\t{type} {obj}', # format of line in "references" section
'bytes_format': '{num}\t {obj}', # format of line in "bytes" section
'types_format': '{num}\t {obj}', # format of line in "types" section
'verbose_types': None, # list of types to get their values sorted by repr length
'verbose_file_name': '/tmp/mem_top', # name of file to store "verbose_types" in
}
# Print out memory every 'batch' created.
PROVIDER_BATCH = 100
PROVIDER = 0
while True:
if (PROVIDER % PROVIDER_BATCH) == 0:
print('MEMORY STATISTICS:\n\n{0}\n\n'.format(mem_top(**MEMORY_PARAMETERS)))
PROVIDER += 1
NetconfServiceProvider(**PROVIDER_PARAMETERS)
sleep(1) # Slow things down to investigate live.
System Information
YDK-0.7.2 with NSO Service Provider