Threads problem: the limbo_lock is making me cry

Greg Landrum gReGlAnDrUm at earthlink.net
Wed May 2 18:13:34 EDT 2001


Obligatory disclosure: I'm using Py2.0 on Win2K

I'm working on some code to do unit testing of wxPython GUI apps.  To make
this go, I've got an xmlrpc server (v0.9.8, though the same thing happens
with 0.9.9) running in a thread in my GUI app, an xmlrpc client running in a
separate thread and the GUI app running normally.  The client thread makes
calls to the server, which dispatches them happily to the GUI using
wxPython's event mechanism.  This all works somewhat more than half the
time.

The other half of the time, I get the following output (with verbose
threads):

MainThread: <_ClientThread(Thread-1, initial)>.start(): starting thread
Thread-1: <_ClientThread(Thread-1, started)>.__bootstrap(): thread started
MainThread: <_ServerThread(Thread-2, initial)>.start(): starting thread
Thread-2: <_ServerThread(Thread-2, started)>.__bootstrap(): thread started
MainThread: <_ServerThread(Thread-2, started)>.join(): waiting until thread
stops
Thread-1: <_ClientThread(Thread-1, started)>.__bootstrap(): normal return
Thread-2: <_ServerThread(Thread-2, started)>.__bootstrap(): normal return
MainThread: <_ServerThread(Thread-2, stopped)>.join(): thread stopped
Unhandled exception in thread:
Traceback (most recent call last):
  File "c:\python20\lib\threading.py", line 392, in __bootstrap
    self.__delete()
  File "c:\python20\lib\threading.py", line 401, in __delete
    _active_limbo_lock.acquire()
AttributeError: 'None' object has no attribute 'acquire'

This problem appears to go away if I include a time.sleep(1) after the end
of the GUI event loop (when this ends, the program stops).

I figure that I must be doing something stupid to see problems with
_active_limbo_lock at all (it just doesn't have the look of a variable name
the user should ever see).[1]  So I was wondering if anyone could give me
some idea of what that stupidity is.

Thanks!
-greg
[1] kind of like the time TeX told me: "This cannot happen." and crashed.




More information about the Python-list mailing list