[FIX] openerp-server: allow missing thread names in dump_stacks
authorOlivier Dony <odo@openerp.com>
Thu, 15 Mar 2012 18:13:55 +0000 (19:13 +0100)
committerOlivier Dony <odo@openerp.com>
Thu, 15 Mar 2012 18:13:55 +0000 (19:13 +0100)
Report-printing threads don't seem to be included
in the list of active threads, but do need to
be dumped as well.

bzr revid: odo@openerp.com-20120315181355-phtkn2uhy638ei1e

openerp-server

index b9fcfb3..f574ebb 100755 (executable)
@@ -169,7 +169,7 @@ def dumpstacks(sig, frame):
     id2name = dict([(threadId, thread.getName()) for threadId, thread in thread_map.items()])
     code = []
     for threadId, stack in sys._current_frames().items():
-        code.append("\n# Thread: %s(%d)" % (id2name[threadId], threadId))
+        code.append("\n# Thread: %s(%d)" % (id2name.get(threadId,'n/a'), threadId))
         for filename, lineno, name, line in traceback.extract_stack(stack):
             code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
             if line: