summaryrefslogtreecommitdiff
path: root/python/qpid/peer.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2006-09-25 17:33:26 +0000
committerAlan Conway <aconway@apache.org>2006-09-25 17:33:26 +0000
commita41dbb3c857bb20cb7df0dbfd75e98652f51fd6d (patch)
tree4e4925c8162d84393f0fd94401f8799d598190ab /python/qpid/peer.py
parentde7a26920620a8d11cc0e0de1c87c11e3f71f27f (diff)
downloadqpid-python-a41dbb3c857bb20cb7df0dbfd75e98652f51fd6d.tar.gz
Close channels on fatal errors to prevent hangs, provide useful stack trace.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@449750 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/peer.py')
-rw-r--r--python/qpid/peer.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/python/qpid/peer.py b/python/qpid/peer.py
index 4179a05568..31d3d24f5f 100644
--- a/python/qpid/peer.py
+++ b/python/qpid/peer.py
@@ -57,13 +57,10 @@ class Peer:
thread.start_new_thread(self.reader, ())
thread.start_new_thread(self.worker, ())
- def fatal(message=None):
- """Call when an unexpected exception occurs that will kill a thread.
-
- In this case it's better to crash the process than to continue in
- an invalid state with a missing thread."""
+ def fatal(self, message=None):
+ """Call when an unexpected exception occurs that will kill a thread."""
if message: print >> sys.stderr, message
- traceback.print_exc()
+ self.close("Fatal error: %s\n%s" % (message or "", traceback.format_exc()))
def reader(self):
try: