Commit 5ef26c24 authored by Jérome Perrin's avatar Jérome Perrin

Custom hack in DeadlockDebbugger to display current mysql query, if any

parent 01e4bf93
...@@ -62,12 +62,24 @@ def dump_threads(): ...@@ -62,12 +62,24 @@ def dump_threads():
if reqinfo: if reqinfo:
reqinfo = " (%s)" % reqinfo reqinfo = " (%s)" % reqinfo
mysql_info = 'no query'
f = frame
try:
from Products.ZMySQLDA.db import DB
while f is not None:
code = f.f_code
if code is DB._query.func_code:
mysql_info = str(f.f_locals['query'])
f = f.f_back
except ImportError:
pass
output = StringIO() output = StringIO()
traceback.print_stack(frame, file=output) traceback.print_stack(frame, file=output)
res.append("Thread %s%s:\n%s" % res.append("Thread %s%s:\n%s\nMySQL query:\n%s\n" %
(thread_id, reqinfo, output.getvalue())) (thread_id, reqinfo, output.getvalue(), mysql_info))
res.append("End of dump") res.append("End of dump\n")
result = '\n'.join(res) result = '\n'.join(res)
if isinstance(result, unicode): if isinstance(result, unicode):
result = result.encode('utf-8') result = result.encode('utf-8')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment