How to debug deadlock?

Aahz aahz at pythoncraft.com
Sat Feb 14 13:05:01 EST 2009


In article <bf6fbab3-7ec7-4210-bc15-ad4e2f6a2f30 at r10g2000prf.googlegroups.com>,
Victor Lin  <Bornstub at gmail.com> wrote:
>
>I am developing a multi-threading application, I encounter a deadlock.
>I use Visual C++ Express 2008 to trace the program. Once the deadlock
>occurs, I just pause the program and trace. I found that when deadlock
>occurs, there will be two threads called python from my C++ extension.
>All of them use Queue in python code, so I guess the deadlock might
>caused by Queue. But however, once the extension goes into python
>code, I can't see nothing but asm code and binary from the VC++
>debugger. I would like to know are there any way to dump the call
>stack of python code after I paused the program? And how can I know
>what lock are there in threads caused the deadlock?

You are already hosed if you have two threads calling into Python,
because you didn't properly acquire the GIL.  I can't help beyond that;
try using the mailing list
http://mail.python.org/mailman/listinfo/capi-sig
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-list mailing list