[Pythonmac-SIG] Re: urllib and ftplib hang in bundle but not when
run directly
Jack Jansen
Jack.Jansen at cwi.nl
Mon May 17 17:39:43 EDT 2004
On 17 May 2004, at 18:26, Russell E Owen wrote:
>> Still, I'd like to debug this, as errors such as this are really
>> nasty.
>> Could you try to attach gdb to the process as it is hanging, and see
>> whether
>> you can find out what lock (if any) you are hanging on?
>
> I'll gladly have a go at that. not having used gdb before I'm
> wondering if anyone can suggest a tutorial or recipe.
I quick google search turned up
<http://www-2.cs.cmu.edu/~gilpin/tutorial/> which looks reasonable. But
it won't explain about multi-threaded debugging:-(
What you want to do is start the app and let it run until it hangs.
Then use "ps" to find the pid. Then run "gdb --pid=PID" to attach to
the process. Type "^c" to gdb to interrupt the hung app and give gdb
control. "info threads" will show you which threads there are. "thread
1" will switch to thread one, etc. "where" will print a stacktrace of
the current thread.
Most likely (hopefully) you'll see that two threads are somewhere in
pthread_mutex_lock or a similar call for the same mutex. one or two
frames up the stack you'll see where the call came from.
> Note that this same code also hangs under RedHat 9.2 linux with Python
> 2.3.3.
Ah, then I misread your original post! This makes it a general problem,
not a mac-specific one, which means there's a bigger chance someone
else came across it. Try asking on comp.lang.python, and/or searching
the bug database for "thread" and "ftplib" or "sre" something like
that.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma
Goldman
More information about the Pythonmac-SIG
mailing list