mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-27 19:37:57 +00:00
Fix memory leaks
For one, configmanager was left with stale callback references, clean those up. For another, the callback pattern was creating a circular reference that python memory management couldn't overcome. Break the reference explicity when an item is disposed of.
This commit is contained in:
parent
b877a95645
commit
09c239b294
@ -413,6 +413,9 @@ class ConsoleHandler(object):
|
||||
if self.connectionthread:
|
||||
self.connectionthread.kill()
|
||||
self.connectionthread = None
|
||||
if self._attribwatcher:
|
||||
self.cfgmgr.remove_watcher(self._attribwatcher)
|
||||
self._attribwatcher = None
|
||||
|
||||
def get_console_output(self, data):
|
||||
# Spawn as a greenthread, return control as soon as possible
|
||||
|
@ -292,6 +292,7 @@ class IpmiConsole(conapi.Console):
|
||||
self.solconnection.out_handler = _donothing
|
||||
self.solconnection.close()
|
||||
self.solconnection = None
|
||||
self.datacallback = None
|
||||
self.broken = True
|
||||
self.error = "closed"
|
||||
|
||||
|
@ -63,6 +63,7 @@ class SshShell(conapi.Console):
|
||||
def __init__(self, node, config, username='', password=''):
|
||||
self.node = node
|
||||
self.ssh = None
|
||||
self.datacallback = None
|
||||
self.nodeconfig = config
|
||||
self.username = username
|
||||
self.password = password
|
||||
@ -155,6 +156,7 @@ class SshShell(conapi.Console):
|
||||
def close(self):
|
||||
if self.ssh is not None:
|
||||
self.ssh.close()
|
||||
self.datacallback = None
|
||||
|
||||
def create(nodes, element, configmanager, inputdata):
|
||||
if len(nodes) == 1:
|
||||
|
@ -116,6 +116,7 @@ class ExecConsole(conapi.Console):
|
||||
break
|
||||
if self.subproc is not None and self.subproc.poll() is None:
|
||||
self.subproc.kill()
|
||||
self._datacallback = None
|
||||
|
||||
|
||||
class Plugin(object):
|
||||
|
Loading…
x
Reference in New Issue
Block a user