python-consul icon indicating copy to clipboard operation
python-consul copied to clipboard

memory leak found by kv.put of twisted consul in HTTPS

Open liucolour opened this issue 7 years ago • 1 comments

I tried below code and saw memory usage keep increasing with 3 conditions combined:

  1. twisted consul api
  2. connect to consul using HTTPS, memory leak didn't happen if HTTP.
  3. kv.put

------------test code -----------------------

from consul.twisted import Consul
from twisted.internet import defer, reactor, task
 
remote_consul = Consul(host='example.com', port=48095, scheme='https')
remote_kv = remote_consul.KV(remote_consul)
 
items = {
'virtassets/24048398b265426c9fd0f4ad061db43b/abcd.host/oper/e': '{"name": "test1", "addr": "somewhere", "property1": "value1", "property2": "value2", "proo
perty3": "value3", "property4": "value4", "property5": "value5", "property6": "value6"}',
'virtassets/24048398b265426c9fd0f4ad061db43b/abcd.host/oper/f': '{"name": "test2", "addr": "somewhere", "property1": "value1", "property2": "value2", "proo
perty3": "value3", "property4": "value4", "property5": "value5", "property6": "value6"}',
'virtassets/24048398b265426c9fd0f4ad061db43b/abcd.host/oper/g': '{"name": "test3", "addr": "somewhere", "property1": "value1", "property2": "value2", "proo
perty3": "value3", "property4": "value4", "property5": "value5", "property6": "value6"}',
}
 
@defer.inlineCallbacks
def start():
   while True:
      print "Start put"
      result_list = []
      for k, v in items.iteritems():
         print "Update key: " + k
         result_list.append(remote_kv.put(k, v))
      yield defer.DeferredList(result_list)
      del result_list
      yield task.deferLater(reactor, 2, lambda: None)
 
start()
reactor.run()

liucolour avatar Aug 31 '18 05:08 liucolour

is there anyone looking at this issue? thanks

liucolour avatar Sep 13 '18 22:09 liucolour