Full traceback in case of crash
This commit is contained in:
parent
b1f1b90235
commit
a54845c44a
1 changed files with 8 additions and 3 deletions
|
@ -7,6 +7,9 @@ import traceback
|
||||||
import socket
|
import socket
|
||||||
import _thread
|
import _thread
|
||||||
|
|
||||||
|
def capture_trace():
|
||||||
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
|
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
||||||
|
|
||||||
class Server:
|
class Server:
|
||||||
def __init__(self, host_port_pair, debug=False):
|
def __init__(self, host_port_pair, debug=False):
|
||||||
|
@ -48,9 +51,11 @@ class Server:
|
||||||
_thread.exit()
|
_thread.exit()
|
||||||
except Exception:
|
except Exception:
|
||||||
Logging.error("An unhandled exception forced the controller for '%s:%d' to terminate." % (sock.address, sock.port))
|
Logging.error("An unhandled exception forced the controller for '%s:%d' to terminate." % (sock.address, sock.port))
|
||||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
capture_trace()
|
||||||
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
try:
|
||||||
handler.finish()
|
handler.finish()
|
||||||
|
except Exception:
|
||||||
|
capture_trace()
|
||||||
if sock in self.socks:
|
if sock in self.socks:
|
||||||
del self.socks[self.socks.index(sock)]
|
del self.socks[self.socks.index(sock)]
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
Reference in a new issue