summaryrefslogtreecommitdiff
path: root/openerp
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2013-11-08 18:52:24 +0100
committerChristophe Simonis <chs@openerp.com>2013-11-08 18:52:24 +0100
commit86fea1e176cda5c682df4eb4e24aff295cb5c894 (patch)
tree51232d3f24f67cb0d0aa0514e344db104eaef770 /openerp
parent3f6ef8741670ef5c840a638d68358f8e5cd95438 (diff)
[IMP] always dumps threads, even in evented mode
bzr revid: chs@openerp.com-20131108175224-tztp2w83vfw9yetz
Diffstat (limited to 'openerp')
-rw-r--r--openerp/cli/server.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/openerp/cli/server.py b/openerp/cli/server.py
index 9d3610f9245..c1ad998e462 100644
--- a/openerp/cli/server.py
+++ b/openerp/cli/server.py
@@ -174,6 +174,19 @@ def dumpstacks(sig, frame):
if line:
yield " %s" % (line.strip(),)
+ # code from http://stackoverflow.com/questions/132058/getting-stack-trace-from-a-running-python-application#answer-2569696
+ # modified for python 2.5 compatibility
+ threads_info = dict([(th.ident, {'name': th.name, 'uid': getattr(th, 'uid', 'n/a')})
+ for th in threading.enumerate()])
+ for threadId, stack in sys._current_frames().items():
+ thread_info = threads_info.get(threadId)
+ code.append("\n# Thread: %s (id:%s) (uid:%s)" %
+ (thread_info and thread_info['name'] or 'n/a',
+ threadId,
+ thread_info and thread_info['uid'] or 'n/a'))
+ for line in extract_stack(stack):
+ code.append(line)
+
if openerp.evented:
# code from http://stackoverflow.com/questions/12510648/in-gevent-how-can-i-dump-stack-traces-of-all-running-greenlets
import gc
@@ -185,20 +198,6 @@ def dumpstacks(sig, frame):
for line in extract_stack(ob.gr_frame):
code.append(line)
- else:
- # code from http://stackoverflow.com/questions/132058/getting-stack-trace-from-a-running-python-application#answer-2569696
- # modified for python 2.5 compatibility
- threads_info = dict([(th.ident, {'name': th.name, 'uid': getattr(th, 'uid', 'n/a')})
- for th in threading.enumerate()])
- for threadId, stack in sys._current_frames().items():
- thread_info = threads_info.get(threadId)
- code.append("\n# Thread: %s (id:%s) (uid:%s)" %
- (thread_info and thread_info['name'] or 'n/a',
- threadId,
- thread_info and thread_info['uid'] or 'n/a'))
- for line in extract_stack(stack):
- code.append(line)
-
_logger.info("\n".join(code))
def setup_signal_handlers(signal_handler):