[FIX] openerp-server: allow missing thread names in dump_stacks

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
This commit is contained in:
Olivier Dony 2012-03-15 19:13:55 +01:00
parent 975667d190
commit 4238bc991e
1 changed files with 1 additions and 1 deletions

View File

@ -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: