Re: [Zope3-dev] Debugging deadlocks in Zope3

2005-07-25 Thread Dieter Maurer
Garrett Smith wrote at 2005-7-24 17:36 -0500:
>Is there any info published on debugging Zope3 deadlocks? I'd like to see 
>tracebacks of a couple threads. Has anyone done this w/Zope3?

"threadframe" might help a bit.

Florent used it to debug deadlocks for Zope2 (--> see its "DeadlockDebugger").
It builds on ZServer. But probably, it will not be too difficult to
make something equivalent for Zope3.

Beside this, I debug deadlocks with GDB: attach to the process,
use "info threads" to learn about all threads, use "thread t" to
switch threads and "bt" to analyse the call stack of a thread.

In "eval_frame" call frames, I use "pfr" (defined as follows) to
determine the corresponding Python code.

def ps
x/s ({PyStringObject}$arg0)->ob_sval
end

def pfr
ps f->f_code->co_filename
ps f->f_code->co_name
#p f->f_lineno
lineno
end

define lineno
set $__co = f->f_code
set $__lasti = f->f_lasti
set $__sz = ((PyStringObject *)$__co->co_lnotab)->ob_size/2
set $__p = (unsigned char *)((PyStringObject *)$__co->co_lnotab)->ob_sval
set $__li = $__co->co_firstlineno
set $__ad = 0
while ($__sz-1 >= 0)
  set $__sz = $__sz - 1
  set $__ad = $__ad + *$__p
  set $__p = $__p + 1
  if ($__ad > $__lasti)
# break -- interpreted as "breakpoint"
set $__sz = -1
  end
  if ($__sz >= 0)
set $__li = $__li + *$__p
set $__p = $__p + 1
  end
end
printf "%d\n", $__li
end


-- 
Dieter
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Debugging deadlocks in Zope3

2005-07-24 Thread Garrett Smith
Is there any info published on debugging Zope3 deadlocks? I'd like to see 
tracebacks of a couple threads. Has anyone done this w/Zope3?

 -- Garrett
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com