winpdb "hangs" when importing module. How to debug?

56 views
Skip to first unread message

Austin Bingham

unread,
Oct 3, 2011, 4:54:33 AM10/3/11
to win...@googlegroups.com
I'm using winpdb (1.4.8) to attach to a remote rpdb2, and I'm running
in to a problem when I start to step through the code. Essentially,
when the code tries to import certain modules, winpdb seems to hang.
Here's how the UI looks:

- The status character for the import line says "L"
- The thread window says that the main thread is waiting at a breakpoint
- The stack trace looks correct
- The tabs in the namespace window are all grayed out/deactivated,
though the locals all look correct
- All of the buttons in the toolbar except for "pause", "encoding",
and "synchronicity" are grayed out.

So, I'm trying to figure out what's going on. Is there some sort of
log that rpdb2 generates? Or some other way to determine what's going
on? The module that's giving me problems loads a number C modules, so
maybe that's related. Any advice on how to move ahead with winpdb
would be great. Thanks!

Austin

Nir Aides

unread,
Oct 3, 2011, 5:06:35 AM10/3/11
to win...@googlegroups.com
the debugger alreay includes some workaround code; take a look at workaround_import_deadlock()
Turns out some std library functions call import with each invocation which can trigger the deadlock.
The typical scenario is a debugger thread calling such std library function while the debugger is paused during an import.
 
try to add tracing to the debugger code to see where it hangs.
hmm... a simple way to locate the problem may be to log the stack in rpdb2_import_wrapper()
 
Thanks,
Nir
 

 

--
You received this message because you are subscribed to the Google Groups "Winpdb" group.
To post to this group, send email to win...@googlegroups.com.
To unsubscribe from this group, send email to winpdb+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/winpdb?hl=en.


Austin Bingham

unread,
Oct 3, 2011, 7:01:16 AM10/3/11
to win...@googlegroups.com
OK, I put a breakpoint in rpdb2_import_wrapper and the stack looks ok.
Everything looks fine until I reach line 13487 where it calls
g_import. If I try to step into or over this method, winpdb simply
spins forever as I described earlier.

Austin

Nir Aides

unread,
Oct 3, 2011, 7:08:06 AM10/3/11
to win...@googlegroups.com
try logging, not stepping :)

Austin Bingham

unread,
Oct 3, 2011, 7:44:26 AM10/3/11
to win...@googlegroups.com
I've attached a stack trace from where it seems to be hanging.
Ultimately, it appears to be hanging when importing "warnings".

Austin

test.py

Nir Aides

unread,
Oct 3, 2011, 7:49:16 AM10/3/11
to win...@googlegroups.com
Yup, it is a new on-the-fly import statement in python 3.1 base64 module that needs to be worked around.

Austin Bingham

unread,
Oct 11, 2011, 4:21:46 AM10/11/11
to win...@googlegroups.com
Is this something relatively easy to tackle? If you can point me in
the right direction, I'd be happy to try to fix it. I'm quite keen to
use winpdb.

Austin

Reply all
Reply to author
Forward
0 new messages