{"action":"created","issue":{"url":"https://api.github.com/repos/CiscoDevNet/ncclient/issues/5","repository_url":"https://api.github.com/repos/CiscoDevNet/ncclient","labels_url":"https://api.github.com/repos/CiscoDevNet/ncclient/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/CiscoDevNet/ncclient/issues/5/comments","events_url":"https://api.github.com/repos/CiscoDevNet/ncclient/issues/5/events","html_url":"https://github.com/CiscoDevNet/ncclient/issues/5","id":376790281,"node_id":"MDU6SXNzdWUzNzY3OTAyODE=","number":5,"title":"Memory Usage","user":{"login":"timho93","id":18057496,"node_id":"MDQ6VXNlcjE4MDU3NDk2","avatar_url":"https://avatars3.githubusercontent.com/u/18057496?v=4","gravatar_id":"","url":"https://api.github.com/users/timho93","html_url":"https://github.com/timho93","followers_url":"https://api.github.com/users/timho93/followers","following_url":"https://api.github.com/users/timho93/following{/other_user}","gists_url":"https://api.github.com/users/timho93/gists{/gist_id}","starred_url":"https://api.github.com/users/timho93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timho93/subscriptions","organizations_url":"https://api.github.com/users/timho93/orgs","repos_url":"https://api.github.com/users/timho93/repos","events_url":"https://api.github.com/users/timho93/events{/privacy}","received_events_url":"https://api.github.com/users/timho93/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-02T12:27:56Z","updated_at":"2018-11-02T21:29:30Z","closed_at":null,"author_association":"NONE","body":"Hey, \r\n\r\ni have some issues with memory usage when using establish_subscription. I subscribe to data of configured IP SLAs. Every second the I am getting a notification. And from the moment of subscription my script has increasing memory usage (ca. 5 MB per minute with only on subscription). Some explanation?\r\n\r\n```\r\ndef establish_subscription(self, netconf_client, xpath, context, period=None, dampening_period=None):\r\n    try:\r\n        if all(var is None for var in [period, dampening_period]):\r\n            logging.warning(\"default dampening period of 1s will be used\" % (self.identification))\r\n            dampening_period = 100\r\n        else:\r\n            s = netconf_client.establish_subscription(\r\n                getattr(self, \"%s_callback\" % context),\r\n                getattr(self, \"default_errback\"),\r\n                period=period,\r\n                dampening_period=dampening_period,\r\n                xpath=xpath)\r\n            if s.subscription_result.endswith('ok'):\r\n                logging.info(\"successfully established subsrciption to xpath %s for node %s \" % (xpath, self.identification))\r\n                return s.subscription_id\r\n    except Exception as e:\r\n        raise Exception(\"failed to establish subscription on node %s \\n %s\" % (self.identification, str(e)))\r\n\r\ndef monitor_rtt_callback(self, notif):\r\n    #logging.info('<<-- Received a notification from node %s !!!' % self.identification )\r\n    # show data included in notification:\r\n    #logging.info(etree.tostring(notif.datastore_ele, pretty_print=True).decode('utf-8'))\r\n    # namespaces which should be exluded in json formatted notification\r\n    namespaces = {\r\n        \"urn:ietf:params:xml:ns:yang:ietf-yang-push\": None,\r\n        \"http://cisco.com/ns/yang/Cisco-IOS-XE-ip-sla-oper\": None\r\n    }\r\n    try:\r\n        json_format = xmltodict.parse(\r\n            etree.tostring(notif.datastore_ele, pretty_print=True).decode('utf-8'),\r\n            process_namespaces=True,\r\n            namespaces=namespaces\r\n        )\r\n    except Exception as e:\r\n        logging.error(str(e))\r\n    datastore = json_format[\"datastore-contents-xml\"]\r\n    ipsla_stats = datastore[\"ip-sla-stats\"][\"sla-oper-entry\"]\r\n    measurement_list = []\r\n    measurement = {}\r\n    measurement.update({\"measurement\": ipsla_stats[\"oper-type\"]})\r\n    measurement.update({\"tags\": {\"oper-id\": ipsla_stats[\"oper-id\"]}})\r\n    measurement.update({\"fields\": {}})\r\n    measurement[\"fields\"].update({\"rtt\": int(ipsla_stats[\"rtt-info\"][\"latest-rtt\"][\"rtt\"])})\r\n    measurement_list.append(measurement)\r\n    ...\r\n```"},"comment":{"url":"https://api.github.com/repos/CiscoDevNet/ncclient/issues/comments/435514879","html_url":"https://github.com/CiscoDevNet/ncclient/issues/5#issuecomment-435514879","issue_url":"https://api.github.com/repos/CiscoDevNet/ncclient/issues/5","id":435514879,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTUxNDg3OQ==","user":{"login":"einarnn","id":5408368,"node_id":"MDQ6VXNlcjU0MDgzNjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5408368?v=4","gravatar_id":"","url":"https://api.github.com/users/einarnn","html_url":"https://github.com/einarnn","followers_url":"https://api.github.com/users/einarnn/followers","following_url":"https://api.github.com/users/einarnn/following{/other_user}","gists_url":"https://api.github.com/users/einarnn/gists{/gist_id}","starred_url":"https://api.github.com/users/einarnn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/einarnn/subscriptions","organizations_url":"https://api.github.com/users/einarnn/orgs","repos_url":"https://api.github.com/users/einarnn/repos","events_url":"https://api.github.com/users/einarnn/events{/privacy}","received_events_url":"https://api.github.com/users/einarnn/received_events","type":"User","site_admin":false},"created_at":"2018-11-02T21:29:30Z","updated_at":"2018-11-02T21:29:30Z","author_association":"COLLABORATOR","body":"Tim,\r\n\r\nWe haven’t done any memory profiling on this. If you’re able to run your script with `cProfile` or `pympler`, and share your results, that would be great.\r\n\r\nCheers,\r\n\r\nEinar"}}
{"actor":{"display_login":"einarnn"}}