summaryrefslogtreecommitdiff
path: root/qpid/python
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
commit6062c7e903daca2aa0d337d5b2ddbc99e9334a32 (patch)
tree8d9ce340a6fd4fff23b31ecde82c5f26a174fce3 /qpid/python
parentaa18915c9497dbf3d8c51210fe4fc906d971d54b (diff)
downloadqpid-python-6062c7e903daca2aa0d337d5b2ddbc99e9334a32.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@449750 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
-rw-r--r--qpid/python/qpid/message.py2
-rw-r--r--qpid/python/qpid/peer.py9
2 files changed, 4 insertions, 7 deletions
diff --git a/qpid/python/qpid/message.py b/qpid/python/qpid/message.py
index 08b3e70c0b..ae06c934c1 100644
--- a/qpid/python/qpid/message.py
+++ b/qpid/python/qpid/message.py
@@ -26,7 +26,7 @@ class Message:
def __len__(self):
l = len(self.fields)
- if method.content:
+ if self.method.content:
l += 1
return len(self.fields)
diff --git a/qpid/python/qpid/peer.py b/qpid/python/qpid/peer.py
index 4179a05568..31d3d24f5f 100644
--- a/qpid/python/qpid/peer.py
+++ b/qpid/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: