Commit 9a3898e4 authored by Julien Muchembled's avatar Julien Muchembled

master: fix crash when aborting early e.g. when failing to open listening socket

Pre-mortem data:
Traceback (most recent call last):
File "neo/master/app.py", line 172, in run
self._run()
File "neo/master/app.py", line 180, in _run
self.listening_conn = ListeningConnection(self, None, self.server)
File "neo/lib/connection.py", line 298, in __init__
connector.makeListeningConnection()
File "neo/lib/connector.py", line 133, in makeListeningConnection
self._error('listen', e)
File "neo/lib/connector.py", line 93, in _error
raise ConnectorException
ConnectorException
Traceback (most recent call last):
  File "neomaster", line 50, in <module>
    sys.exit(neo.scripts.neomaster.main())
  File "neo/scripts/neomaster.py", line 31, in main
    app.run()
  File "neo/master/app.py", line 175, in run
    self.log()
  File "neo/master/app.py", line 167, in log
    if self.pt is not None:
AttributeError: 'Application' object has no attribute 'pt'
parent b6f821a2
......@@ -197,12 +197,6 @@ class Application(BaseApplication, Monitor):
self.master_conn = None
self.master_node = None
def log(self):
self.em.log()
self.nm.log()
if self.pt is not None:
self.pt.log()
def run(self):
try:
self._run()
......
......@@ -103,6 +103,13 @@ class BaseApplication(object):
self.em.close()
self.__dict__.clear()
def log(self):
self.em.log()
self.nm.log()
pt = self.__dict__.get('pt')
if pt is not None:
pt.log()
def setUUID(self, uuid):
if self.uuid != uuid:
self.uuid = uuid
......
......@@ -98,13 +98,6 @@ class ThreadedApplication(BaseApplication):
def setHandlerData(self, data):
self._thread_container.answer = data
def log(self):
self.em.log()
self.nm.log()
pt = self.__dict__.get('pt')
if pt is not None:
pt.log()
def _handlePacket(self, conn, packet, kw={}, handler=None):
"""
conn
......
......@@ -162,13 +162,10 @@ class Application(BaseApplication):
super(Application, self).close()
def log(self):
self.em.log()
super(Application, self).log()
self.tm.log()
if self.backup_app is not None:
self.backup_app.log()
self.nm.log()
self.tm.log()
if self.pt is not None:
self.pt.log()
def run(self):
try:
......
......@@ -88,6 +88,7 @@ class BackupApplication(object):
logging.info('Upstream Node ID: %s', uuid_str(uuid))
def log(self):
logging.info('Backup:')
self.nm.log()
if self.pt is not None:
self.pt.log()
......
......@@ -147,12 +147,9 @@ class Application(BaseApplication):
self.em.poll(1)
def log(self):
self.em.log()
self.nm.log()
super(Application, self).log()
if self.tm:
self.tm.log()
if self.pt is not None:
self.pt.log()
def loadConfiguration(self):
"""Load persistent configuration data from the database.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment